-
Notifications
You must be signed in to change notification settings - Fork 99
/
actionview-generated.rbs
10768 lines (9580 loc) · 452 KB
/
actionview-generated.rbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# The generated code is based on Ruby on Rails source code
# You can find the license of Ruby on Rails from following.
#Copyright (c) 2005-2019 David Heinemeier Hansson
#
#Permission is hereby granted, free of charge, to any person obtaining
#a copy of this software and associated documentation files (the
#"Software"), to deal in the Software without restriction, including
#without limitation the rights to use, copy, modify, merge, publish,
#distribute, sublicense, and/or sell copies of the Software, and to
#permit persons to whom the Software is furnished to do so, subject to
#the following conditions:
#
#The above copyright notice and this permission notice shall be
#included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
#LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module ActionView
# nodoc:
# = Action View Base
#
# Action View templates can be written in several ways.
# If the template file has a <tt>.erb</tt> extension, then it uses the erubi[https://rubygems.org/gems/erubi]
# template system which can embed Ruby into an HTML document.
# If the template file has a <tt>.builder</tt> extension, then Jim Weirich's Builder::XmlMarkup library is used.
#
# == ERB
#
# You trigger ERB by using embeddings such as <tt><% %></tt>, <tt><% -%></tt>, and <tt><%= %></tt>. The <tt><%= %></tt> tag set is used when you want output. Consider the
# following loop for names:
#
# <b>Names of all the people</b>
# <% @people.each do |person| %>
# Name: <%= person.name %><br/>
# <% end %>
#
# The loop is setup in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
# is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
#
# <%# WRONG %>
# Hi, Mr. <% puts "Frodo" %>
#
# If you absolutely must write from within a function use +concat+.
#
# When on a line that only contains whitespaces except for the tag, <tt><% %></tt> suppresses leading and trailing whitespace,
# including the trailing newline. <tt><% %></tt> and <tt><%- -%></tt> are the same.
# Note however that <tt><%= %></tt> and <tt><%= -%></tt> are different: only the latter removes trailing whitespaces.
#
# === Using sub templates
#
# Using sub templates allows you to sidestep tedious replication and extract common display structures in shared templates. The
# classic example is the use of a header and footer (even though the Action Pack-way would be to use Layouts):
#
# <%= render "shared/header" %>
# Something really specific and terrific
# <%= render "shared/footer" %>
#
# As you see, we use the output embeddings for the render methods. The render call itself will just return a string holding the
# result of the rendering. The output embedding writes it to the current template.
#
# But you don't have to restrict yourself to static includes. Templates can share variables amongst themselves by using instance
# variables defined using the regular embedding tags. Like this:
#
# <% @page_title = "A Wonderful Hello" %>
# <%= render "shared/header" %>
#
# Now the header can pick up on the <tt>@page_title</tt> variable and use it for outputting a title tag:
#
# <title><%= @page_title %></title>
#
# === Passing local variables to sub templates
#
# You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values:
#
# <%= render "shared/header", { headline: "Welcome", person: person } %>
#
# These can now be accessed in <tt>shared/header</tt> with:
#
# Headline: <%= headline %>
# First name: <%= person.first_name %>
#
# The local variables passed to sub templates can be accessed as a hash using the <tt>local_assigns</tt> hash. This lets you access the
# variables as:
#
# Headline: <%= local_assigns[:headline] %>
#
# This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use
# <tt>defined? headline</tt> to first check if the variable has been assigned before using it.
#
# === Template caching
#
# By default, Rails will compile each template to a method in order to render it. When you alter a template,
# Rails will check the file's modification time and recompile it in development mode.
#
# == Builder
#
# Builder templates are a more programmatic alternative to ERB. They are especially useful for generating XML content. An XmlMarkup object
# named +xml+ is automatically made available to templates with a <tt>.builder</tt> extension.
#
# Here are some basic examples:
#
# xml.em("emphasized") # => <em>emphasized</em>
# xml.em { xml.b("emph & bold") } # => <em><b>emph & bold</b></em>
# xml.a("A Link", "href" => "http://onestepback.org") # => <a href="http://onestepback.org">A Link</a>
# xml.target("name" => "compile", "option" => "fast") # => <target option="fast" name="compile"\>
# # NOTE: order of attributes is not specified.
#
# Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following:
#
# xml.div do
# xml.h1(@person.name)
# xml.p(@person.bio)
# end
#
# would produce something like:
#
# <div>
# <h1>David Heinemeier Hansson</h1>
# <p>A product of Danish Design during the Winter of '79...</p>
# </div>
#
# Here is a full-length RSS example actually used on Basecamp:
#
# xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
# xml.channel do
# xml.title(@feed_title)
# xml.link(@url)
# xml.description "Basecamp: Recent items"
# xml.language "en-us"
# xml.ttl "40"
#
# @recent_items.each do |item|
# xml.item do
# xml.title(item_title(item))
# xml.description(item_description(item)) if item_description(item)
# xml.pubDate(item_pubDate(item))
# xml.guid(@person.firm.account.url + @recent_items.url(item))
# xml.link(@person.firm.account.url + @recent_items.url(item))
#
# xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
# end
# end
# end
# end
#
# For more information on Builder please consult the {source
# code}[https://github.com/jimweirich/builder].
class Base
include Helpers
include ::ERB::Util
include Context
def self.cache_template_loading: () -> untyped
def self.cache_template_loading=: (untyped value) -> untyped
def self.xss_safe?: () -> ::TrueClass
def self.with_empty_template_cache: () -> untyped
def self.changed?: (untyped other) -> untyped
attr_reader view_renderer: untyped
attr_reader lookup_context: untyped
attr_accessor config(@_config): ActiveSupport::InheritableOptions
attr_accessor assigns(@_assigns): untyped
def assign: (untyped new_assigns) -> untyped
def self.build_lookup_context: (untyped context) -> untyped
def self.empty: () -> untyped
def self.with_view_paths: (untyped view_paths, ?::Hash[untyped, untyped] assigns, ?untyped? controller) -> untyped
def self.with_context: (untyped context, ?::Hash[untyped, untyped] assigns, ?untyped? controller) -> untyped
NULL: untyped
def initialize: (?untyped? lookup_context, ?::Hash[untyped, untyped] assigns, ?untyped? controller, ?untyped formats) -> untyped
def _run: (untyped method, untyped template, untyped locals, untyped buffer) { () -> untyped } -> untyped
def compiled_method_container: () -> untyped
def in_rendering_context: (untyped options) { (untyped) -> untyped } -> untyped
end
end
module ActionView
class OutputBuffer < ActiveSupport::SafeBuffer
# Used as a buffer for views
#
# The main difference between this and ActiveSupport::SafeBuffer
# is for the methods `<<` and `safe_expr_append=` the inputs are
# checked for nil before they are assigned and `to_s` is called on
# the input. For example:
#
# obuf = ActionView::OutputBuffer.new "hello"
# obuf << 5
# puts obuf # => "hello5"
#
# sbuf = ActiveSupport::SafeBuffer.new "hello"
# sbuf << 5
# puts sbuf # => "hello\u0005"
#
# nodoc:
def initialize: () -> untyped
def <<: (untyped value) -> untyped
alias append= <<
def safe_expr_append=: (untyped val) -> untyped
alias safe_append= safe_concat
end
class StreamingBuffer
# nodoc:
def initialize: (untyped block) -> untyped
def <<: (untyped value) -> untyped
alias concat <<
alias append= <<
def safe_concat: (untyped value) -> untyped
alias safe_append= safe_concat
def html_safe?: () -> ::TrueClass
def html_safe: () -> untyped
end
end
module ActionView
class CacheExpiry
class Executor
def initialize: (watcher: untyped watcher) -> untyped
def before: (untyped target) -> untyped
end
def initialize: (watcher: untyped watcher) -> untyped
def clear_cache_if_necessary: () -> untyped
def clear_cache: () -> untyped
private
def dirs_to_watch: () -> untyped
def all_view_paths: () -> untyped
end
end
module ActionView
# = Action View Context
#
# Action View contexts are supplied to Action Controller to render a template.
# The default Action View context is ActionView::Base.
#
# In order to work with Action Controller, a Context must just include this
# module. The initialization of the variables used by the context
# (@output_buffer, @view_flow, and @virtual_path) is responsibility of the
# object that includes this module (although you can call _prepare_context
# defined below).
module Context
attr_accessor output_buffer: untyped
attr_accessor view_flow: untyped
# Prepares the context by setting the appropriate instance variables.
def _prepare_context: () -> untyped
# Encapsulates the interaction with the view flow so it
# returns the correct buffer on +yield+. This is usually
# overwritten by helpers to add more behavior.
def _layout_for: (?untyped? name) -> untyped
end
end
module ActionView
class DependencyTracker
def self.find_dependencies: (untyped name, untyped template, ?untyped? view_paths) -> (::Array[untyped] | untyped)
def self.register_tracker: (untyped `extension`, untyped tracker) -> untyped
def self.remove_tracker: (untyped handler) -> untyped
class ERBTracker
# :nodoc:
EXPLICIT_DEPENDENCY: untyped
# A valid ruby identifier - suitable for class, method and specially variable names
IDENTIFIER: untyped
# Any kind of variable name. e.g. @instance, @@class, $global or local.
# Possibly following a method call chain
VARIABLE_OR_METHOD_CHAIN: untyped
# A simple string literal. e.g. "School's out!"
STRING: untyped
# Part of any hash containing the :partial key
PARTIAL_HASH_KEY: untyped
# Part of any hash containing the :layout key
LAYOUT_HASH_KEY: untyped
# Matches:
# partial: "comments/comment", collection: @all_comments => "comments/comment"
# (object: @single_comment, partial: "comments/comment") => "comments/comment"
#
# "comments/comments"
# 'comments/comments'
# ('comments/comments')
#
# (@topic) => "topics/topic"
# topics => "topics/topic"
# (message.topics) => "topics/topic"
RENDER_ARGUMENTS: untyped
LAYOUT_DEPENDENCY: untyped
def self.supports_view_paths?: () -> ::TrueClass
def self.call: (untyped name, untyped template, ?untyped? view_paths) -> untyped
def initialize: (untyped name, untyped template, ?untyped? view_paths) -> untyped
def dependencies: () -> untyped
private
attr_reader name: untyped
attr_reader template: untyped
def source: () -> untyped
def directory: () -> untyped
def render_dependencies: () -> untyped
def add_dependencies: (untyped render_dependencies, untyped arguments, untyped pattern) -> untyped
def add_dynamic_dependency: (untyped dependencies, untyped dependency) -> untyped
def add_static_dependency: (untyped dependencies, untyped dependency) -> untyped
def resolve_directories: (untyped wildcard_dependencies) -> (::Array[untyped] | untyped)
def explicit_dependencies: () -> untyped
end
end
end
module ActionView
class Digestor
# Supported options:
#
# * <tt>name</tt> - Template name
# * <tt>format</tt> - Template format
# * <tt>finder</tt> - An instance of <tt>ActionView::LookupContext</tt>
# * <tt>dependencies</tt> - An array of dependent views
def self.digest: (finder: untyped finder, name: untyped name, ?dependencies: untyped? dependencies, ?format: untyped? format) -> untyped
def self.logger: () -> untyped
# Create a dependency tree for template named +name+.
def self.tree: (untyped name, untyped finder, ?bool partial, ?::Hash[untyped, untyped] seen) -> untyped
private
def self.find_template: (untyped finder, untyped name, untyped prefixes, untyped partial, untyped keys) -> untyped
public
class Node
attr_reader name: untyped
attr_reader logical_name: untyped
attr_reader template: untyped
attr_reader children: untyped
def self.create: (untyped name, untyped logical_name, untyped template, untyped partial) -> untyped
def initialize: (untyped name, untyped logical_name, untyped template, ?untyped children) -> untyped
def digest: (untyped finder, ?untyped stack) -> untyped
def dependency_digest: (untyped finder, untyped stack) -> untyped
def to_dep_map: () -> untyped
end
class Partial < Node
end
class Missing < Node
def digest: (untyped finder, ?untyped _) -> ::String
end
class Injected < Node
def digest: (untyped finder, ?untyped _) -> untyped
end
class NullLogger
def self.debug: (untyped _) -> nil
def self.error: (untyped _) -> nil
end
end
end
module ActionView
class OutputFlow
# nodoc:
attr_reader content: untyped
def initialize: () -> untyped
# Called by _layout_for to read stored values.
def get: (untyped key) -> untyped
# Called by each renderer object to set the layout contents.
def set: (untyped key, untyped value) -> untyped
# Called by content_for
def append: (untyped key, untyped value) -> untyped
alias append! append
end
class StreamingFlow < OutputFlow
# nodoc:
def initialize: (untyped view, untyped fiber) -> untyped
# Try to get stored content. If the content
# is not available and we're inside the layout fiber,
# then it will begin waiting for the given key and yield.
def get: (untyped key) -> untyped
# Appends the contents for the given key. This is called
# by providing and resuming back to the fiber,
# if that's the key it's waiting for.
def append!: (untyped key, untyped value) -> untyped
private
def inside_fiber?: () -> untyped
end
end
module ActionView
# Returns the version of the currently loaded Action View as a <tt>Gem::Version</tt>
def self.gem_version: () -> Gem::Version
module VERSION
MAJOR: ::Integer
MINOR: ::Integer
TINY: ::Integer
PRE: ::String
STRING: untyped
end
end
module ActionView
module Helpers
# = Active Model Helpers
# nodoc:
module ActiveModelHelper
end
module ActiveModelInstanceTag
def object: () -> untyped
def content_tag: (untyped `type`, untyped options) -> untyped
def tag: (untyped `type`, untyped options) -> untyped
def error_wrapping: (untyped html_tag) -> untyped
def error_message: () -> untyped
private
def object_has_errors?: () -> untyped
def select_markup_helper?: (untyped `type`) -> untyped
def tag_generate_errors?: (untyped options) -> untyped
end
end
end
module ActionView
module Helpers
# = Action View Asset Tag Helpers
# nodoc:
# This module provides methods for generating HTML that links views to assets such
# as images, JavaScripts, stylesheets, and feeds. These methods do not verify
# the assets exist before linking to them:
#
# image_tag("rails.png")
# # => <img src="/assets/rails.png" />
# stylesheet_link_tag("application")
# # => <link href="/assets/application.css?body=1" media="screen" rel="stylesheet" />
module AssetTagHelper
extend ActiveSupport::Concern
include AssetUrlHelper
include TagHelper
# Returns an HTML script tag for each of the +sources+ provided.
#
# Sources may be paths to JavaScript files. Relative paths are assumed to be relative
# to <tt>assets/javascripts</tt>, full paths are assumed to be relative to the document
# root. Relative paths are idiomatic, use absolute paths only when needed.
#
# When passing paths, the ".js" extension is optional. If you do not want ".js"
# appended to the path <tt>extname: false</tt> can be set on the options.
#
# You can modify the HTML attributes of the script tag by passing a hash as the
# last argument.
#
# When the Asset Pipeline is enabled, you can pass the name of your manifest as
# source, and include other JavaScript or CoffeeScript files inside the manifest.
#
# If the server supports Early Hints header links for these assets will be
# automatically pushed.
#
# ==== Options
#
# When the last parameter is a hash you can add HTML attributes using that
# parameter. The following options are supported:
#
# * <tt>:extname</tt> - Append an extension to the generated URL unless the extension
# already exists. This only applies for relative URLs.
# * <tt>:protocol</tt> - Sets the protocol of the generated URL. This option only
# applies when a relative URL and +host+ options are provided.
# * <tt>:host</tt> - When a relative URL is provided the host is added to the
# that path.
# * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
# when it is set to true.
# * <tt>:nonce</tt> - When set to true, adds an automatic nonce value if
# you have Content Security Policy enabled.
#
# ==== Examples
#
# javascript_include_tag "xmlhr"
# # => <script src="/assets/xmlhr.debug-1284139606.js"></script>
#
# javascript_include_tag "xmlhr", host: "localhost", protocol: "https"
# # => <script src="https://localhost/assets/xmlhr.debug-1284139606.js"></script>
#
# javascript_include_tag "template.jst", extname: false
# # => <script src="/assets/template.debug-1284139606.jst"></script>
#
# javascript_include_tag "xmlhr.js"
# # => <script src="/assets/xmlhr.debug-1284139606.js"></script>
#
# javascript_include_tag "common.javascript", "/elsewhere/cools"
# # => <script src="/assets/common.javascript.debug-1284139606.js"></script>
# # <script src="/elsewhere/cools.debug-1284139606.js"></script>
#
# javascript_include_tag "http://www.example.com/xmlhr"
# # => <script src="http://www.example.com/xmlhr"></script>
#
# javascript_include_tag "http://www.example.com/xmlhr.js"
# # => <script src="http://www.example.com/xmlhr.js"></script>
#
# javascript_include_tag "http://www.example.com/xmlhr.js", nonce: true
# # => <script src="http://www.example.com/xmlhr.js" nonce="..."></script>
def javascript_include_tag: (*untyped sources) -> untyped
# Returns a stylesheet link tag for the sources specified as arguments. If
# you don't specify an extension, <tt>.css</tt> will be appended automatically.
# You can modify the link attributes by passing a hash as the last argument.
# For historical reasons, the 'media' attribute will always be present and defaults
# to "screen", so you must explicitly set it to "all" for the stylesheet(s) to
# apply to all media types.
#
# If the server supports Early Hints header links for these assets will be
# automatically pushed.
#
# stylesheet_link_tag "style"
# # => <link href="/assets/style.css" media="screen" rel="stylesheet" />
#
# stylesheet_link_tag "style.css"
# # => <link href="/assets/style.css" media="screen" rel="stylesheet" />
#
# stylesheet_link_tag "http://www.example.com/style.css"
# # => <link href="http://www.example.com/style.css" media="screen" rel="stylesheet" />
#
# stylesheet_link_tag "style", media: "all"
# # => <link href="/assets/style.css" media="all" rel="stylesheet" />
#
# stylesheet_link_tag "style", media: "print"
# # => <link href="/assets/style.css" media="print" rel="stylesheet" />
#
# stylesheet_link_tag "random.styles", "/css/stylish"
# # => <link href="/assets/random.styles" media="screen" rel="stylesheet" />
# # <link href="/css/stylish.css" media="screen" rel="stylesheet" />
def stylesheet_link_tag: (*untyped sources) -> untyped
# Returns a link tag that browsers and feed readers can use to auto-detect
# an RSS, Atom, or JSON feed. The +type+ can be <tt>:rss</tt> (default),
# <tt>:atom</tt>, or <tt>:json</tt>. Control the link options in url_for format
# using the +url_options+. You can modify the LINK tag itself in +tag_options+.
#
# ==== Options
#
# * <tt>:rel</tt> - Specify the relation of this link, defaults to "alternate"
# * <tt>:type</tt> - Override the auto-generated mime type
# * <tt>:title</tt> - Specify the title of the link, defaults to the +type+
#
# ==== Examples
#
# auto_discovery_link_tag
# # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/action" />
# auto_discovery_link_tag(:atom)
# # => <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.currenthost.com/controller/action" />
# auto_discovery_link_tag(:json)
# # => <link rel="alternate" type="application/json" title="JSON" href="http://www.currenthost.com/controller/action" />
# auto_discovery_link_tag(:rss, {action: "feed"})
# # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/feed" />
# auto_discovery_link_tag(:rss, {action: "feed"}, {title: "My RSS"})
# # => <link rel="alternate" type="application/rss+xml" title="My RSS" href="http://www.currenthost.com/controller/feed" />
# auto_discovery_link_tag(:rss, {controller: "news", action: "feed"})
# # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/news/feed" />
# auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "Example RSS"})
# # => <link rel="alternate" type="application/rss+xml" title="Example RSS" href="http://www.example.com/feed.rss" />
def auto_discovery_link_tag: (?::Symbol `type`, ?::Hash[untyped, untyped] url_options, ?::Hash[untyped, untyped] tag_options) -> untyped
# Returns a link tag for a favicon managed by the asset pipeline.
#
# If a page has no link like the one generated by this helper, browsers
# ask for <tt>/favicon.ico</tt> automatically, and cache the file if the
# request succeeds. If the favicon changes it is hard to get it updated.
#
# To have better control applications may let the asset pipeline manage
# their favicon storing the file under <tt>app/assets/images</tt>, and
# using this helper to generate its corresponding link tag.
#
# The helper gets the name of the favicon file as first argument, which
# defaults to "favicon.ico", and also supports +:rel+ and +:type+ options
# to override their defaults, "shortcut icon" and "image/x-icon"
# respectively:
#
# favicon_link_tag
# # => <link href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon" />
#
# favicon_link_tag 'myicon.ico'
# # => <link href="/assets/myicon.ico" rel="shortcut icon" type="image/x-icon" />
#
# Mobile Safari looks for a different link tag, pointing to an image that
# will be used if you add the page to the home screen of an iOS device.
# The following call would generate such a tag:
#
# favicon_link_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png'
# # => <link href="/assets/mb-icon.png" rel="apple-touch-icon" type="image/png" />
def favicon_link_tag: (?::String source, ?::Hash[untyped, untyped] options) -> untyped
# Returns a link tag that browsers can use to preload the +source+.
# The +source+ can be the path of a resource managed by asset pipeline,
# a full path, or an URI.
#
# ==== Options
#
# * <tt>:type</tt> - Override the auto-generated mime type, defaults to the mime type for +source+ extension.
# * <tt>:as</tt> - Override the auto-generated value for as attribute, calculated using +source+ extension and mime type.
# * <tt>:crossorigin</tt> - Specify the crossorigin attribute, required to load cross-origin resources.
# * <tt>:nopush</tt> - Specify if the use of server push is not desired for the resource. Defaults to +false+.
#
# ==== Examples
#
# preload_link_tag("custom_theme.css")
# # => <link rel="preload" href="/assets/custom_theme.css" as="style" type="text/css" />
#
# preload_link_tag("/videos/video.webm")
# # => <link rel="preload" href="/videos/video.mp4" as="video" type="video/webm" />
#
# preload_link_tag(post_path(format: :json), as: "fetch")
# # => <link rel="preload" href="/posts.json" as="fetch" type="application/json" />
#
# preload_link_tag("worker.js", as: "worker")
# # => <link rel="preload" href="/assets/worker.js" as="worker" type="text/javascript" />
#
# preload_link_tag("//example.com/font.woff2")
# # => <link rel="preload" href="//example.com/font.woff2" as="font" type="font/woff2" crossorigin="anonymous"/>
#
# preload_link_tag("//example.com/font.woff2", crossorigin: "use-credentials")
# # => <link rel="preload" href="//example.com/font.woff2" as="font" type="font/woff2" crossorigin="use-credentials" />
#
# preload_link_tag("/media/audio.ogg", nopush: true)
# # => <link rel="preload" href="/media/audio.ogg" as="audio" type="audio/ogg" />
#
def preload_link_tag: (untyped source, ?::Hash[untyped, untyped] options) -> untyped
# Returns an HTML image tag for the +source+. The +source+ can be a full
# path, a file, or an Active Storage attachment.
#
# ==== Options
#
# You can add HTML attributes using the +options+. The +options+ supports
# additional keys for convenience and conformance:
#
# * <tt>:size</tt> - Supplied as "{Width}x{Height}" or "{Number}", so "30x45" becomes
# width="30" and height="45", and "50" becomes width="50" and height="50".
# <tt>:size</tt> will be ignored if the value is not in the correct format.
# * <tt>:srcset</tt> - If supplied as a hash or array of <tt>[source, descriptor]</tt>
# pairs, each image path will be expanded before the list is formatted as a string.
#
# ==== Examples
#
# Assets (images that are part of your app):
#
# image_tag("icon")
# # => <img src="/assets/icon" />
# image_tag("icon.png")
# # => <img src="/assets/icon.png" />
# image_tag("icon.png", size: "16x10", alt: "Edit Entry")
# # => <img src="/assets/icon.png" width="16" height="10" alt="Edit Entry" />
# image_tag("/icons/icon.gif", size: "16")
# # => <img src="/icons/icon.gif" width="16" height="16" />
# image_tag("/icons/icon.gif", height: '32', width: '32')
# # => <img height="32" src="/icons/icon.gif" width="32" />
# image_tag("/icons/icon.gif", class: "menu_icon")
# # => <img class="menu_icon" src="/icons/icon.gif" />
# image_tag("/icons/icon.gif", data: { title: 'Rails Application' })
# # => <img data-title="Rails Application" src="/icons/icon.gif" />
# image_tag("icon.png", srcset: { "icon_2x.png" => "2x", "icon_4x.png" => "4x" })
# # => <img src="/assets/icon.png" srcset="/assets/icon_2x.png 2x, /assets/icon_4x.png 4x">
# image_tag("pic.jpg", srcset: [["pic_1024.jpg", "1024w"], ["pic_1980.jpg", "1980w"]], sizes: "100vw")
# # => <img src="/assets/pic.jpg" srcset="/assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw">
#
# Active Storage blobs (images that are uploaded by the users of your app):
#
# image_tag(user.avatar)
# # => <img src="/rails/active_storage/blobs/.../tiger.jpg" />
# image_tag(user.avatar.variant(resize_to_limit: [100, 100]))
# # => <img src="/rails/active_storage/representations/.../tiger.jpg" />
# image_tag(user.avatar.variant(resize_to_limit: [100, 100]), size: '100')
# # => <img width="100" height="100" src="/rails/active_storage/representations/.../tiger.jpg" />
def image_tag: (untyped source, ?::Hash[untyped, untyped] options) -> untyped
# Returns an HTML video tag for the +sources+. If +sources+ is a string,
# a single video tag will be returned. If +sources+ is an array, a video
# tag with nested source tags for each source will be returned. The
# +sources+ can be full paths or files that exist in your public videos
# directory.
#
# ==== Options
#
# When the last parameter is a hash you can add HTML attributes using that
# parameter. The following options are supported:
#
# * <tt>:poster</tt> - Set an image (like a screenshot) to be shown
# before the video loads. The path is calculated like the +src+ of +image_tag+.
# * <tt>:size</tt> - Supplied as "{Width}x{Height}" or "{Number}", so "30x45" becomes
# width="30" and height="45", and "50" becomes width="50" and height="50".
# <tt>:size</tt> will be ignored if the value is not in the correct format.
# * <tt>:poster_skip_pipeline</tt> will bypass the asset pipeline when using
# the <tt>:poster</tt> option instead using an asset in the public folder.
#
# ==== Examples
#
# video_tag("trailer")
# # => <video src="/videos/trailer"></video>
# video_tag("trailer.ogg")
# # => <video src="/videos/trailer.ogg"></video>
# video_tag("trailer.ogg", controls: true, preload: 'none')
# # => <video preload="none" controls="controls" src="/videos/trailer.ogg"></video>
# video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png")
# # => <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png"></video>
# video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png", poster_skip_pipeline: true)
# # => <video src="/videos/trailer.m4v" width="16" height="10" poster="screenshot.png"></video>
# video_tag("/trailers/hd.avi", size: "16x16")
# # => <video src="/trailers/hd.avi" width="16" height="16"></video>
# video_tag("/trailers/hd.avi", size: "16")
# # => <video height="16" src="/trailers/hd.avi" width="16"></video>
# video_tag("/trailers/hd.avi", height: '32', width: '32')
# # => <video height="32" src="/trailers/hd.avi" width="32"></video>
# video_tag("trailer.ogg", "trailer.flv")
# # => <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video>
# video_tag(["trailer.ogg", "trailer.flv"])
# # => <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video>
# video_tag(["trailer.ogg", "trailer.flv"], size: "160x120")
# # => <video height="120" width="160"><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video>
def video_tag: (*untyped sources) -> untyped
# Returns an HTML audio tag for the +sources+. If +sources+ is a string,
# a single audio tag will be returned. If +sources+ is an array, an audio
# tag with nested source tags for each source will be returned. The
# +sources+ can be full paths or files that exist in your public audios
# directory.
#
# When the last parameter is a hash you can add HTML attributes using that
# parameter.
#
# audio_tag("sound")
# # => <audio src="/audios/sound"></audio>
# audio_tag("sound.wav")
# # => <audio src="/audios/sound.wav"></audio>
# audio_tag("sound.wav", autoplay: true, controls: true)
# # => <audio autoplay="autoplay" controls="controls" src="/audios/sound.wav"></audio>
# audio_tag("sound.wav", "sound.mid")
# # => <audio><source src="/audios/sound.wav" /><source src="/audios/sound.mid" /></audio>
def audio_tag: (*untyped sources) -> untyped
private
def multiple_sources_tag_builder: (untyped `type`, untyped sources) { (untyped) -> untyped } -> untyped
def resolve_image_source: (untyped source, untyped skip_pipeline) -> untyped
def extract_dimensions: (untyped size) -> untyped
def check_for_image_tag_errors: (untyped options) -> untyped
def resolve_link_as: (untyped extname, untyped mime_type) -> untyped
end
end
end
module ActionView
module Helpers
# = Action View Asset URL Helpers
# nodoc:
# This module provides methods for generating asset paths and
# URLs.
#
# image_path("rails.png")
# # => "/assets/rails.png"
#
# image_url("rails.png")
# # => "http://www.example.com/assets/rails.png"
#
# === Using asset hosts
#
# By default, Rails links to these assets on the current host in the public
# folder, but you can direct Rails to link to assets from a dedicated asset
# server by setting <tt>ActionController::Base.asset_host</tt> in the application
# configuration, typically in <tt>config/environments/production.rb</tt>.
# For example, you'd define <tt>assets.example.com</tt> to be your asset
# host this way, inside the <tt>configure</tt> block of your environment-specific
# configuration files or <tt>config/application.rb</tt>:
#
# config.action_controller.asset_host = "assets.example.com"
#
# Helpers take that into account:
#
# image_tag("rails.png")
# # => <img src="http://assets.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
# # => <link href="http://assets.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# Browsers open a limited number of simultaneous connections to a single
# host. The exact number varies by browser and version. This limit may cause
# some asset downloads to wait for previous assets to finish before they can
# begin. You can use the <tt>%d</tt> wildcard in the +asset_host+ to
# distribute the requests over four hosts. For example,
# <tt>assets%d.example.com</tt> will spread the asset requests over
# "assets0.example.com", ..., "assets3.example.com".
#
# image_tag("rails.png")
# # => <img src="http://assets0.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
# # => <link href="http://assets2.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# This may improve the asset loading performance of your application.
# It is also possible the combination of additional connection overhead
# (DNS, SSL) and the overall browser connection limits may result in this
# solution being slower. You should be sure to measure your actual
# performance across targeted browsers both before and after this change.
#
# To implement the corresponding hosts you can either setup four actual
# hosts or use wildcard DNS to CNAME the wildcard to a single asset host.
# You can read more about setting up your DNS CNAME records from your ISP.
#
# Note: This is purely a browser performance optimization and is not meant
# for server load balancing. See https://www.die.net/musings/page_load_time/
# for background and https://www.browserscope.org/?category=network for
# connection limit data.
#
# Alternatively, you can exert more control over the asset host by setting
# +asset_host+ to a proc like this:
#
# ActionController::Base.asset_host = Proc.new { |source|
# "http://assets#{Digest::MD5.hexdigest(source).to_i(16) % 2 + 1}.example.com"
# }
# image_tag("rails.png")
# # => <img src="http://assets1.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
# # => <link href="http://assets2.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# The example above generates "http://assets1.example.com" and
# "http://assets2.example.com". This option is useful for example if
# you need fewer/more than four hosts, custom host names, etc.
#
# As you see the proc takes a +source+ parameter. That's a string with the
# absolute path of the asset, for example "/assets/rails.png".
#
# ActionController::Base.asset_host = Proc.new { |source|
# if source.ends_with?('.css')
# "http://stylesheets.example.com"
# else
# "http://assets.example.com"
# end
# }
# image_tag("rails.png")
# # => <img src="http://assets.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
# # => <link href="http://stylesheets.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# Alternatively you may ask for a second parameter +request+. That one is
# particularly useful for serving assets from an SSL-protected page. The
# example proc below disables asset hosting for HTTPS connections, while
# still sending assets for plain HTTP requests from asset hosts. If you don't
# have SSL certificates for each of the asset hosts this technique allows you
# to avoid warnings in the client about mixed media.
# Note that the +request+ parameter might not be supplied, e.g. when the assets
# are precompiled with the command `rails assets:precompile`. Make sure to use a
# +Proc+ instead of a lambda, since a +Proc+ allows missing parameters and sets them
# to +nil+.
#
# config.action_controller.asset_host = Proc.new { |source, request|
# if request && request.ssl?
# "#{request.protocol}#{request.host_with_port}"
# else
# "#{request.protocol}assets.example.com"
# end
# }
#
# You can also implement a custom asset host object that responds to +call+
# and takes either one or two parameters just like the proc.
#
# config.action_controller.asset_host = AssetHostingWithMinimumSsl.new(
# "http://asset%d.example.com", "https://asset1.example.com"
# )
#
module AssetUrlHelper
URI_REGEXP: untyped
# This is the entry point for all assets.
# When using the asset pipeline (i.e. sprockets and sprockets-rails), the
# behavior is "enhanced". You can bypass the asset pipeline by passing in
# <tt>skip_pipeline: true</tt> to the options.
#
# All other asset *_path helpers delegate through this method.
#
# === With the asset pipeline
#
# All options passed to +asset_path+ will be passed to +compute_asset_path+
# which is implemented by sprockets-rails.
#
# asset_path("application.js") # => "/assets/application-60aa4fdc5cea14baf5400fba1abf4f2a46a5166bad4772b1effe341570f07de9.js"
#
# === Without the asset pipeline (<tt>skip_pipeline: true</tt>)
#
# Accepts a <tt>type</tt> option that can specify the asset's extension. No error
# checking is done to verify the source passed into +asset_path+ is valid
# and that the file exists on disk.
#
# asset_path("application.js", skip_pipeline: true) # => "application.js"
# asset_path("filedoesnotexist.png", skip_pipeline: true) # => "filedoesnotexist.png"
# asset_path("application", type: :javascript, skip_pipeline: true) # => "/javascripts/application.js"
# asset_path("application", type: :stylesheet, skip_pipeline: true) # => "/stylesheets/application.css"
#
# === Options applying to all assets
#
# Below lists scenarios that apply to +asset_path+ whether or not you're
# using the asset pipeline.
#
# - All fully qualified URLs are returned immediately. This bypasses the