# typed: true # DO NOT EDIT MANUALLY # This is an autogenerated file for types exported from the `actionview` gem. # Please instead update this file by running `bin/tapioca gem actionview`. module ActionView extend ::ActiveSupport::Autoload class << self def eager_load!; end # Returns the currently loaded version of Action View as a Gem::Version. def gem_version; end # Returns the currently loaded version of Action View as a Gem::Version. def version; end end end # This class defines the interface for a renderer. Each class that # subclasses +AbstractRenderer+ is used by the base +Renderer+ class to # render a specific type of object. # # The base +Renderer+ class uses its +render+ method to delegate to the # renderers. These currently consist of # # PartialRenderer - Used for rendering partials # TemplateRenderer - Used for rendering other types of templates # StreamingTemplateRenderer - Used for streaming # # Whenever the +render+ method is called on the base +Renderer+ class, a new # renderer object of the correct type is created, and the +render+ method on # that new object is called in turn. This abstracts the set up and rendering # into a separate classes for partials and templates. class ActionView::AbstractRenderer # @return [AbstractRenderer] a new instance of AbstractRenderer def initialize(lookup_context); end def any_templates?(*_arg0, &_arg1); end def formats(*_arg0, &_arg1); end # @raise [NotImplementedError] def render; end def template_exists?(*_arg0, &_arg1); end private def build_rendered_collection(templates, spacer); end def build_rendered_template(content, template); end def extract_details(options); end def prepend_formats(formats); end end ActionView::AbstractRenderer::NO_DETAILS = T.let(T.unsafe(nil), Hash) module ActionView::AbstractRenderer::ObjectRendering def initialize(lookup_context, options); end private def local_variable(path); end def merge_prefix_into_object_path(prefix, object_path); end # Obtains the path to where the object's partial is located. If the object # responds to +to_partial_path+, then +to_partial_path+ will be called and # will provide the path. If the object does not respond to +to_partial_path+, # then an +ArgumentError+ is raised. # # If +prefix_partial_path_with_controller_namespace+ is true, then this # method will prefix the partial paths with a namespace. def partial_path(object, view); end # @raise [ArgumentError] def raise_invalid_identifier(path); end # @raise [ArgumentError] def raise_invalid_option_as(as); end end ActionView::AbstractRenderer::ObjectRendering::IDENTIFIER_ERROR_MESSAGE = T.let(T.unsafe(nil), String) ActionView::AbstractRenderer::ObjectRendering::OPTION_AS_ERROR_MESSAGE = T.let(T.unsafe(nil), String) ActionView::AbstractRenderer::ObjectRendering::PREFIXED_PARTIAL_NAMES = T.let(T.unsafe(nil), Concurrent::Map) class ActionView::AbstractRenderer::RenderedCollection # @return [RenderedCollection] a new instance of RenderedCollection def initialize(rendered_templates, spacer); end def body; end def format; end # Returns the value of attribute rendered_templates. def rendered_templates; end class << self def empty(format); end end end class ActionView::AbstractRenderer::RenderedCollection::EmptyCollection # @return [EmptyCollection] a new instance of EmptyCollection def initialize(format); end def body; end # Returns the value of attribute format. def format; end end class ActionView::AbstractRenderer::RenderedTemplate # @return [RenderedTemplate] a new instance of RenderedTemplate def initialize(body, template); end # Returns the value of attribute body. def body; end def format; end # Returns the value of attribute template. def template; end end ActionView::AbstractRenderer::RenderedTemplate::EMPTY_SPACER = T.let(T.unsafe(nil), T.untyped) # = Action View Errors class ActionView::ActionViewError < ::StandardError; end # = Action View Base # # Action View templates can be written in several ways. # If the template file has a .erb 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 .builder extension, then Jim Weirich's Builder::XmlMarkup library is used. # # == ERB # # You trigger ERB by using embeddings such as <% %>, <% -%>, and <%= %>. The <%= %> tag set is used when you want output. Consider the # following loop for names: # # Names of all the people # <% @people.each do |person| %> # Name: <%= person.name %>
# <% end %> # # The loop is set up in regular embedding tags <% %>, and the name is written using the output embedding tag <%= %>. 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, <% %> suppresses leading and trailing whitespace, # including the trailing newline. <% %> and <%- -%> are the same. # Note however that <%= %> and <%= -%> 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 @page_title variable and use it for outputting a title tag: # # <%= @page_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 shared/header with: # # Headline: <%= headline %> # First name: <%= person.first_name %> # # The local variables passed to sub templates can be accessed as a hash using the local_assigns 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 # defined? headline 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 .builder extension. # # Here are some basic examples: # # xml.em("emphasized") # => emphasized # xml.em { xml.b("emph & bold") } # => emph & bold # xml.a("A Link", "href" => "http://onestepback.org") # => A Link # xml.target("name" => "compile", "option" => "fast") # => # # 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: # #
#

David Heinemeier Hansson

#

A product of Danish Design during the Winter of '79...

#
# # 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 ActionView::Base include ::ActionView::Context include ::ERB::Util include ::ActiveSupport::Benchmarkable include ::ActionView::Helpers::ActiveModelHelper include ::ActionView::Helpers::AssetUrlHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper include ::ActionView::Helpers::UrlHelper include ::ActionView::Helpers::SanitizeHelper include ::ActionView::Helpers::AssetTagHelper include ::ActionView::Helpers::AtomFeedHelper include ::ActionView::Helpers::CacheHelper include ::ActionView::Helpers::ControllerHelper include ::ActionView::Helpers::CspHelper include ::ActionView::Helpers::CsrfHelper include ::ActionView::Helpers::DateHelper include ::ActionView::Helpers::DebugHelper include ::ActionView::Helpers::TextHelper include ::ActionView::Helpers::FormTagHelper include ::ActionView::ModelNaming include ::ActionView::RecordIdentifier include ::ActionView::Helpers::FormHelper include ::ActionView::Helpers::TranslationHelper include ::ActionView::Helpers::FormOptionsHelper include ::ActionView::Helpers::JavaScriptHelper include ::ActionView::Helpers::NumberHelper include ::ActionView::Helpers::RenderingHelper include ::ActionView::Helpers extend ::ActionView::Helpers::UrlHelper::ClassMethods extend ::ActionView::Helpers::SanitizeHelper::ClassMethods # :startdoc: # # @return [Base] a new instance of Base def initialize(lookup_context, assigns, controller); end def _routes; end def _routes=(_arg0); end def _routes?; end def _run(method, template, locals, buffer, add_to_stack: T.unsafe(nil), &block); end def annotate_rendered_view_with_filenames; end def annotate_rendered_view_with_filenames=(val); end def assign(new_assigns); end def assigns; end def assigns=(_arg0); end def automatically_disable_submit_tag; end def automatically_disable_submit_tag=(val); end # @raise [NotImplementedError] def compiled_method_container; end def config; end def config=(_arg0); end def debug_missing_translation; end def debug_missing_translation=(val); end def default_formats; end def default_formats=(val); end def field_error_proc; end def field_error_proc=(val); end def formats(*_arg0, &_arg1); end def formats=(arg); end def in_rendering_context(options); end def locale(*_arg0, &_arg1); end def locale=(arg); end def logger; end def logger=(_arg0); end def logger?; end # Returns the value of attribute lookup_context. def lookup_context; end def prefix_partial_path_with_controller_namespace; end def prefix_partial_path_with_controller_namespace=(_arg0); end def prefix_partial_path_with_controller_namespace?; end def streaming_completion_on_exception; end def streaming_completion_on_exception=(val); end def view_paths(*_arg0, &_arg1); end def view_paths=(arg); end # Returns the value of attribute view_renderer. def view_renderer; end class << self def _routes; end def _routes=(value); end def _routes?; end def annotate_rendered_view_with_filenames; end def annotate_rendered_view_with_filenames=(val); end def automatically_disable_submit_tag; end def automatically_disable_submit_tag=(val); end def cache_template_loading; end def cache_template_loading=(value); end # @return [Boolean] def changed?(other); end def debug_missing_translation; end def debug_missing_translation=(val); end def default_form_builder; end def default_form_builder=(val); end def default_formats; end def default_formats=(val); end # :stopdoc: def empty; end def erb_trim_mode=(arg); end def field_error_proc; end def field_error_proc=(val); end def logger; end def logger=(value); end def logger?; end def prefix_partial_path_with_controller_namespace; end def prefix_partial_path_with_controller_namespace=(value); end def prefix_partial_path_with_controller_namespace?; end def streaming_completion_on_exception; end def streaming_completion_on_exception=(val); end def with_context(context, assigns = T.unsafe(nil), controller = T.unsafe(nil)); end def with_empty_template_cache; end def with_view_paths(view_paths, assigns = T.unsafe(nil), controller = T.unsafe(nil)); end # @return [Boolean] def xss_safe?; end end end class ActionView::CacheExpiry; end class ActionView::CacheExpiry::Executor # @return [Executor] a new instance of Executor def initialize(watcher:); end def complete(_); end def run; end private def clear_cache; end end class ActionView::CacheExpiry::ViewModificationWatcher # @return [ViewModificationWatcher] a new instance of ViewModificationWatcher def initialize(watcher:, &block); end def execute_if_updated; end private def all_view_paths; end def dirs_to_watch; end end module ActionView::CollectionCaching extend ::ActiveSupport::Concern private def cache_collection_render(instrumentation_payload, view, template, collection); end # @return [Boolean] def callable_cache_key?; end def collection_by_cache_keys(view, template, collection); end def expanded_cache_key(key, view, template, digest_path); end # `order_by` is an enumerable object containing keys of the cache, # all keys are passed in whether found already or not. # # `cached_partials` is a hash. If the value exists # it represents the rendered partial from the cache # otherwise `Hash#fetch` will take the value of its block. # # This method expects a block that will return the rendered # partial. An example is to render all results # for each element that was not found in the cache and store it as an array. # Order it so that the first empty cache element in `cached_partials` # corresponds to the first element in `rendered_partials`. # # If the partial is not already cached it will also be # written back to the underlying cache store. def fetch_or_cache_partial(cached_partials, template, order_by:); end # @return [Boolean] def will_cache?(options, view); end end class ActionView::CollectionRenderer < ::ActionView::PartialRenderer include ::ActionView::AbstractRenderer::ObjectRendering def render_collection_derive_partial(collection, context, block); end def render_collection_with_partial(collection, partial, context, block); end private def collection_with_template(view, template, layout, collection); end def render_collection(collection, view, path, template, layout, block); end def retrieve_variable(path); end end class ActionView::CollectionRenderer::CollectionIterator include ::Enumerable # @return [CollectionIterator] a new instance of CollectionIterator def initialize(collection); end def each(&blk); end def length; end def size; end end class ActionView::CollectionRenderer::MixedCollectionIterator < ::ActionView::CollectionRenderer::CollectionIterator # @return [MixedCollectionIterator] a new instance of MixedCollectionIterator def initialize(collection, paths); end def each_with_info; end end class ActionView::CollectionRenderer::PreloadCollectionIterator < ::ActionView::CollectionRenderer::SameCollectionIterator # @return [PreloadCollectionIterator] a new instance of PreloadCollectionIterator def initialize(collection, path, variables, relation); end def each_with_info; end def from_collection(collection); end end class ActionView::CollectionRenderer::SameCollectionIterator < ::ActionView::CollectionRenderer::CollectionIterator # @return [SameCollectionIterator] a new instance of SameCollectionIterator def initialize(collection, path, variables); end def each_with_info; end def from_collection(collection); end end # = 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 ActionView::Context # 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(name = T.unsafe(nil)); end # Prepares the context by setting the appropriate instance variables. def _prepare_context; end # Returns the value of attribute output_buffer. def output_buffer; end # Sets the attribute output_buffer # # @param value the value to set the attribute output_buffer to. def output_buffer=(_arg0); end # Returns the value of attribute view_flow. def view_flow; end # Sets the attribute view_flow # # @param value the value to set the attribute view_flow to. def view_flow=(_arg0); end end class ActionView::DependencyTracker extend ::ActiveSupport::Autoload class << self def find_dependencies(name, template, view_paths = T.unsafe(nil)); end def register_tracker(extension, tracker); end def remove_tracker(handler); end end end class ActionView::DependencyTracker::ERBTracker # @return [ERBTracker] a new instance of ERBTracker def initialize(name, template, view_paths = T.unsafe(nil)); end def dependencies; end private def add_dependencies(render_dependencies, arguments, pattern); end def add_dynamic_dependency(dependencies, dependency); end def add_static_dependency(dependencies, dependency, quote_type); end def directory; end def explicit_dependencies; end # Returns the value of attribute name. def name; end def render_dependencies; end def resolve_directories(wildcard_dependencies); end def source; end # Returns the value of attribute template. def template; end class << self def call(name, template, view_paths = T.unsafe(nil)); end # @return [Boolean] def supports_view_paths?; end end end ActionView::DependencyTracker::ERBTracker::EXPLICIT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) # A valid ruby identifier - suitable for class, method and specially variable names ActionView::DependencyTracker::ERBTracker::IDENTIFIER = T.let(T.unsafe(nil), Regexp) ActionView::DependencyTracker::ERBTracker::LAYOUT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) # Part of any hash containing the :layout key ActionView::DependencyTracker::ERBTracker::LAYOUT_HASH_KEY = T.let(T.unsafe(nil), Regexp) # Part of any hash containing the :partial key ActionView::DependencyTracker::ERBTracker::PARTIAL_HASH_KEY = T.let(T.unsafe(nil), Regexp) # 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" ActionView::DependencyTracker::ERBTracker::RENDER_ARGUMENTS = T.let(T.unsafe(nil), Regexp) # A simple string literal. e.g. "School's out!" ActionView::DependencyTracker::ERBTracker::STRING = T.let(T.unsafe(nil), Regexp) # Any kind of variable name. e.g. @instance, @@class, $global or local. # Possibly following a method call chain ActionView::DependencyTracker::ERBTracker::VARIABLE_OR_METHOD_CHAIN = T.let(T.unsafe(nil), Regexp) class ActionView::DependencyTracker::RipperTracker # @return [RipperTracker] a new instance of RipperTracker def initialize(name, template, view_paths = T.unsafe(nil)); end def dependencies; end private def explicit_dependencies; end # Returns the value of attribute name. def name; end def render_dependencies; end def resolve_directories(wildcard_dependencies); end # Returns the value of attribute template. def template; end # Returns the value of attribute view_paths. def view_paths; end class << self def call(name, template, view_paths = T.unsafe(nil)); end # @return [Boolean] def supports_view_paths?; end end end ActionView::DependencyTracker::RipperTracker::EXPLICIT_DEPENDENCY = T.let(T.unsafe(nil), Regexp) class ActionView::Digestor class << self # Supported options: # # * name - Template name # * format - Template format # * finder - An instance of ActionView::LookupContext # * dependencies - An array of dependent views def digest(name:, finder:, format: T.unsafe(nil), dependencies: T.unsafe(nil)); end def logger; end # Create a dependency tree for template named +name+. def tree(name, finder, partial = T.unsafe(nil), seen = T.unsafe(nil)); end private def find_template(finder, name, prefixes, partial, keys); end end end class ActionView::Digestor::Injected < ::ActionView::Digestor::Node def digest(finder, _ = T.unsafe(nil)); end end class ActionView::Digestor::Missing < ::ActionView::Digestor::Node def digest(finder, _ = T.unsafe(nil)); end end class ActionView::Digestor::Node # @return [Node] a new instance of Node def initialize(name, logical_name, template, children = T.unsafe(nil)); end # Returns the value of attribute children. def children; end def dependency_digest(finder, stack); end def digest(finder, stack = T.unsafe(nil)); end # Returns the value of attribute logical_name. def logical_name; end # Returns the value of attribute name. def name; end # Returns the value of attribute template. def template; end def to_dep_map; end class << self def create(name, logical_name, template, partial); end end end class ActionView::Digestor::NullLogger class << self def debug(_); end def error(_); end end end class ActionView::Digestor::Partial < ::ActionView::Digestor::Node; end ActionView::ENCODING_FLAG = T.let(T.unsafe(nil), String) class ActionView::EncodingError < ::StandardError; end # A resolver that loads files from the filesystem. class ActionView::FileSystemResolver < ::ActionView::Resolver # @raise [ArgumentError] # @return [FileSystemResolver] a new instance of FileSystemResolver def initialize(path); end # @return [Boolean] def ==(resolver); end def all_template_paths; end def clear_cache; end # @return [Boolean] def eql?(resolver); end # Returns the value of attribute path. def path; end def to_path; end def to_s; end private def _find_all(name, prefix, partial, details, key, locals); end def build_unbound_template(template); end def escape_entry(entry); end def filter_and_sort_by_details(templates, requested_details); end def source_for_template(template); end # Safe glob within @path def template_glob(glob); end def unbound_templates_from_path(path); end end # = Action View Debug Helper # # Provides a set of methods for making it easier to debug Rails objects. module ActionView::Helpers include ::ActiveSupport::Benchmarkable include ::ActionView::Helpers::ActiveModelHelper include ::ActionView::Helpers::AssetUrlHelper include ::ActionView::Helpers::SanitizeHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper include ::ActionView::Helpers::AssetTagHelper include ::ActionView::Helpers::AtomFeedHelper include ::ActionView::Helpers::CacheHelper include ::ActionView::Helpers::ControllerHelper include ::ActionView::Helpers::CspHelper include ::ActionView::Helpers::CsrfHelper include ::ActionView::Helpers::DateHelper include ::ActionView::Helpers::DebugHelper include ::ActionView::Helpers::TextHelper include ::ActionView::Helpers::FormOptionsHelper include ::ActionView::Helpers::JavaScriptHelper include ::ActionView::Helpers::NumberHelper include ::ActionView::Helpers::RenderingHelper extend ::ActiveSupport::Autoload extend ::ActiveSupport::Concern include ::ActionView::Helpers::UrlHelper include ::ActionView::Helpers::SanitizeHelper include ::ActionView::Helpers::TextHelper include ::ActionView::Helpers::FormTagHelper include ::ActionView::Helpers::FormHelper include ::ActionView::Helpers::TranslationHelper mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods class << self def eager_load!; end end end module ActionView::Helpers::ActiveModelHelper; end module ActionView::Helpers::ActiveModelInstanceTag def content_tag(type, options, *_arg2); end def error_message; end def error_wrapping(html_tag); end def object; end def tag(type, options, *_arg2); end private # @return [Boolean] def object_has_errors?; end # @return [Boolean] def select_markup_helper?(type); end # @return [Boolean] def tag_generate_errors?(options); end end # 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") # # => # stylesheet_link_tag("application") # # => module ActionView::Helpers::AssetTagHelper include ::ActionView::Helpers::AssetUrlHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper def apply_stylesheet_media_default; end def apply_stylesheet_media_default=(val); end # 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_tag("sound.wav") # # => # audio_tag("sound.wav", autoplay: true, controls: true) # # => # audio_tag("sound.wav", "sound.mid") # # => def audio_tag(*sources); end # Returns a link tag that browsers and feed readers can use to auto-detect # an RSS, Atom, or JSON feed. The +type+ can be :rss (default), # :atom, or :json. Control the link options in url_for format # using the +url_options+. You can modify the LINK tag itself in +tag_options+. # # ==== Options # # * :rel - Specify the relation of this link, defaults to "alternate" # * :type - Override the auto-generated mime type # * :title - Specify the title of the link, defaults to the +type+ # # ==== Examples # # auto_discovery_link_tag # # => # auto_discovery_link_tag(:atom) # # => # auto_discovery_link_tag(:json) # # => # auto_discovery_link_tag(:rss, {action: "feed"}) # # => # auto_discovery_link_tag(:rss, {action: "feed"}, {title: "My RSS"}) # # => # auto_discovery_link_tag(:rss, {controller: "news", action: "feed"}) # # => # auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "Example RSS"}) # # => def auto_discovery_link_tag(type = T.unsafe(nil), url_options = T.unsafe(nil), tag_options = T.unsafe(nil)); end # 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 /favicon.ico 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 app/assets/images, 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, "icon" and "image/x-icon" # respectively: # # favicon_link_tag # # => # # favicon_link_tag 'myicon.ico' # # => # # 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' # # => def favicon_link_tag(source = T.unsafe(nil), options = T.unsafe(nil)); end def image_decoding; end def image_decoding=(val); end def image_loading; end def image_loading=(val); end # 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: # # * :size - Supplied as "{Width}x{Height}" or "{Number}", so "30x45" becomes # width="30" and height="45", and "50" becomes width="50" and height="50". # :size will be ignored if the value is not in the correct format. # * :srcset - If supplied as a hash or array of [source, descriptor] # 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") # # => # image_tag("icon.png") # # => # image_tag("icon.png", size: "16x10", alt: "Edit Entry") # # => Edit Entry # image_tag("/icons/icon.gif", size: "16") # # => # image_tag("/icons/icon.gif", height: '32', width: '32') # # => # image_tag("/icons/icon.gif", class: "menu_icon") # # => # image_tag("/icons/icon.gif", data: { title: 'Rails Application' }) # # => # image_tag("icon.png", srcset: { "icon_2x.png" => "2x", "icon_4x.png" => "4x" }) # # => # image_tag("pic.jpg", srcset: [["pic_1024.jpg", "1024w"], ["pic_1980.jpg", "1980w"]], sizes: "100vw") # # => # # Active Storage blobs (images that are uploaded by the users of your app): # # image_tag(user.avatar) # # => # image_tag(user.avatar.variant(resize_to_limit: [100, 100])) # # => # image_tag(user.avatar.variant(resize_to_limit: [100, 100]), size: '100') # # => def image_tag(source, options = T.unsafe(nil)); end # 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 assets/javascripts, 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 extname: false 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: # # * :extname - Append an extension to the generated URL unless the extension # already exists. This only applies for relative URLs. # * :protocol - Sets the protocol of the generated URL. This option only # applies when a relative URL and +host+ options are provided. # * :host - When a relative URL is provided the host is added to the # that path. # * :skip_pipeline - This option is used to bypass the asset pipeline # when it is set to true. # * :nonce - When set to true, adds an automatic nonce value if # you have Content Security Policy enabled. # # ==== Examples # # javascript_include_tag "xmlhr" # # => # # javascript_include_tag "xmlhr", host: "localhost", protocol: "https" # # => # # javascript_include_tag "template.jst", extname: false # # => # # javascript_include_tag "xmlhr.js" # # => # # javascript_include_tag "common.javascript", "/elsewhere/cools" # # => # # # # javascript_include_tag "http://www.example.com/xmlhr" # # => # # javascript_include_tag "http://www.example.com/xmlhr.js" # # => # # javascript_include_tag "http://www.example.com/xmlhr.js", nonce: true # # => def javascript_include_tag(*sources); end # 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 # # * :type - Override the auto-generated mime type, defaults to the mime type for +source+ extension. # * :as - Override the auto-generated value for as attribute, calculated using +source+ extension and mime type. # * :crossorigin - Specify the crossorigin attribute, required to load cross-origin resources. # * :nopush - Specify if the use of server push is not desired for the resource. Defaults to +false+. # * :integrity - Specify the integrity attribute. # # ==== Examples # # preload_link_tag("custom_theme.css") # # => # # preload_link_tag("/videos/video.webm") # # => # # preload_link_tag(post_path(format: :json), as: "fetch") # # => # # preload_link_tag("worker.js", as: "worker") # # => # # preload_link_tag("//example.com/font.woff2") # # => # # preload_link_tag("//example.com/font.woff2", crossorigin: "use-credentials") # # => # # preload_link_tag("/media/audio.ogg", nopush: true) # # => def preload_link_tag(source, options = T.unsafe(nil)); end def preload_links_header; end def preload_links_header=(val); end # Returns a stylesheet link tag for the sources specified as arguments. # # When passing paths, the .css extension is optional. # If you don't specify an extension, .css will be appended automatically. # If you do not want .css appended to the path, # set extname: false in the options. # You can modify the link attributes by passing a hash as the last argument. # # If the server supports Early Hints header links for these assets will be # automatically pushed. # # ==== Options # # * :extname - Append an extension to the generated URL unless the extension # already exists. This only applies for relative URLs. # * :protocol - Sets the protocol of the generated URL. This option only # applies when a relative URL and +host+ options are provided. # * :host - When a relative URL is provided the host is added to the # that path. # * :skip_pipeline - This option is used to bypass the asset pipeline # when it is set to true. # # ==== Examples # # stylesheet_link_tag "style" # # => # # stylesheet_link_tag "style.css" # # => # # stylesheet_link_tag "http://www.example.com/style.css" # # => # # stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less" # # => # # stylesheet_link_tag "style", media: "all" # # => # # stylesheet_link_tag "style", media: "print" # # => # # stylesheet_link_tag "random.styles", "/css/stylish" # # => # # def stylesheet_link_tag(*sources); end # 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: # # * :poster - Set an image (like a screenshot) to be shown # before the video loads. The path is calculated like the +src+ of +image_tag+. # * :size - Supplied as "{Width}x{Height}" or "{Number}", so "30x45" becomes # width="30" and height="45", and "50" becomes width="50" and height="50". # :size will be ignored if the value is not in the correct format. # * :poster_skip_pipeline will bypass the asset pipeline when using # the :poster option instead using an asset in the public folder. # # ==== Examples # # video_tag("trailer") # # => # video_tag("trailer.ogg") # # => # video_tag("trailer.ogg", controls: true, preload: 'none') # # => # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png") # # => # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png", poster_skip_pipeline: true) # # => # video_tag("/trailers/hd.avi", size: "16x16") # # => # video_tag("/trailers/hd.avi", size: "16") # # => # video_tag("/trailers/hd.avi", height: '32', width: '32') # # => # video_tag("trailer.ogg", "trailer.flv") # # => # video_tag(["trailer.ogg", "trailer.flv"]) # # => # video_tag(["trailer.ogg", "trailer.flv"], size: "160x120") # # => def video_tag(*sources); end private def check_for_image_tag_errors(options); end def extract_dimensions(size); end # @yield [options] def multiple_sources_tag_builder(type, sources); end def resolve_image_source(source, skip_pipeline); end def resolve_link_as(extname, mime_type); end def send_preload_links_header(preload_links, max_header_size: T.unsafe(nil)); end class << self def apply_stylesheet_media_default; end def apply_stylesheet_media_default=(val); end def image_decoding; end def image_decoding=(val); end def image_loading; end def image_loading=(val); end def preload_links_header; end def preload_links_header=(val); end end end # Some HTTP client and proxies have a 8kiB header limit ActionView::Helpers::AssetTagHelper::MAX_HEADER_SIZE = T.let(T.unsafe(nil), Integer) # 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 ActionController::Base.asset_host in the application # configuration, typically in config/environments/production.rb. # For example, you'd define assets.example.com to be your asset # host this way, inside the configure block of your environment-specific # configuration files or config/application.rb: # # config.action_controller.asset_host = "assets.example.com" # # Helpers take that into account: # # image_tag("rails.png") # # => # stylesheet_link_tag("application") # # => # # 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 %d wildcard in the +asset_host+ to # distribute the requests over four hosts. For example, # assets%d.example.com will spread the asset requests over # "assets0.example.com", ..., "assets3.example.com". # # image_tag("rails.png") # # => # stylesheet_link_tag("application") # # => # # 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 set up 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#{OpenSSL::Digest::SHA256.hexdigest(source).to_i(16) % 2 + 1}.example.com" # } # image_tag("rails.png") # # => # stylesheet_link_tag("application") # # => # # 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.end_with?('.css') # "http://stylesheets.example.com" # else # "http://assets.example.com" # end # } # image_tag("rails.png") # # => # stylesheet_link_tag("application") # # => # # 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 bin/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 ActionView::Helpers::AssetUrlHelper # This is the entry point for all assets. # When using an asset pipeline gem (e.g. propshaft or sprockets-rails), the # behavior is "enhanced". You can bypass the asset pipeline by passing in # skip_pipeline: true 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 asset pipeline gems. # # asset_path("application.js") # => "/assets/application-60aa4fdc5cea14baf5400fba1abf4f2a46a5166bad4772b1effe341570f07de9.js" # asset_path('application.js', host: 'example.com') # => "//example.com/assets/application.js" # asset_path("application.js", host: 'example.com', protocol: 'https') # => "https://example.com/assets/application.js" # # === Without the asset pipeline (skip_pipeline: true) # # Accepts a type 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 # asset pipeline and all other behavior described. # # asset_path("http://www.example.com/js/xmlhr.js") # => "http://www.example.com/js/xmlhr.js" # # - All assets that begin with a forward slash are assumed to be full # URLs and will not be expanded. This will bypass the asset pipeline. # # asset_path("/foo.png") # => "/foo.png" # # - All blank strings will be returned immediately. This bypasses the # asset pipeline and all other behavior described. # # asset_path("") # => "" # # - If config.relative_url_root is specified, all assets will have that # root prepended. # # Rails.application.config.relative_url_root = "bar" # asset_path("foo.js", skip_pipeline: true) # => "bar/foo.js" # # - A different asset host can be specified via config.action_controller.asset_host # this is commonly used in conjunction with a CDN. # # Rails.application.config.action_controller.asset_host = "assets.example.com" # asset_path("foo.js", skip_pipeline: true) # => "http://assets.example.com/foo.js" # # - An extension name can be specified manually with extname. # # asset_path("foo", skip_pipeline: true, extname: ".js") # => "/foo.js" # asset_path("foo.css", skip_pipeline: true, extname: ".js") # => "/foo.css.js" # # @raise [ArgumentError] def asset_path(source, options = T.unsafe(nil)); end # Computes the full URL to an asset in the public directory. This # will use +asset_path+ internally, so most of their behaviors # will be the same. If +:host+ options is set, it overwrites global # +config.action_controller.asset_host+ setting. # # All other options provided are forwarded to +asset_path+ call. # # asset_url "application.js" # => http://example.com/assets/application.js # asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/assets/application.js def asset_url(source, options = T.unsafe(nil)); end # Computes the path to an audio asset in the public audios directory. # Full paths from the document root will be passed through. # Used internally by +audio_tag+ to build the audio path. # # audio_path("horse") # => /audios/horse # audio_path("horse.wav") # => /audios/horse.wav # audio_path("sounds/horse.wav") # => /audios/sounds/horse.wav # audio_path("/sounds/horse.wav") # => /sounds/horse.wav # audio_path("http://www.example.com/sounds/horse.wav") # => http://www.example.com/sounds/horse.wav def audio_path(source, options = T.unsafe(nil)); end # Computes the full URL to an audio asset in the public audios directory. # This will use +audio_path+ internally, so most of their behaviors will be the same. # Since +audio_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # audio_url "horse.wav", host: "http://stage.example.com" # => http://stage.example.com/audios/horse.wav def audio_url(source, options = T.unsafe(nil)); end # Compute extname to append to asset path. Returns +nil+ if # nothing should be added. def compute_asset_extname(source, options = T.unsafe(nil)); end # Pick an asset host for this source. Returns +nil+ if no host is set, # the host if no wildcard is set, the host interpolated with the # numbers 0-3 if it contains %d (the number is the source hash mod 4), # or the value returned from invoking call on an object responding to call # (proc or otherwise). def compute_asset_host(source = T.unsafe(nil), options = T.unsafe(nil)); end # Computes asset path to public directory. Plugins and # extensions can override this method to point to custom assets # or generate digested paths or query strings. def compute_asset_path(source, options = T.unsafe(nil)); end # Computes the path to a font asset. # Full paths from the document root will be passed through. # # font_path("font") # => /fonts/font # font_path("font.ttf") # => /fonts/font.ttf # font_path("dir/font.ttf") # => /fonts/dir/font.ttf # font_path("/dir/font.ttf") # => /dir/font.ttf # font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf def font_path(source, options = T.unsafe(nil)); end # Computes the full URL to a font asset. # This will use +font_path+ internally, so most of their behaviors will be the same. # Since +font_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # font_url "font.ttf", host: "http://stage.example.com" # => http://stage.example.com/fonts/font.ttf def font_url(source, options = T.unsafe(nil)); end # Computes the path to an image asset. # Full paths from the document root will be passed through. # Used internally by +image_tag+ to build the image path: # # image_path("edit") # => "/assets/edit" # image_path("edit.png") # => "/assets/edit.png" # image_path("icons/edit.png") # => "/assets/icons/edit.png" # image_path("/icons/edit.png") # => "/icons/edit.png" # image_path("http://www.example.com/img/edit.png") # => "http://www.example.com/img/edit.png" # # If you have images as application resources this method may conflict with their named routes. # The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and # plugin authors are encouraged to do so. def image_path(source, options = T.unsafe(nil)); end # Computes the full URL to an image asset. # This will use +image_path+ internally, so most of their behaviors will be the same. # Since +image_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # image_url "edit.png", host: "http://stage.example.com" # => http://stage.example.com/assets/edit.png def image_url(source, options = T.unsafe(nil)); end # Computes the path to a JavaScript asset in the public javascripts directory. # If the +source+ filename has no extension, .js will be appended (except for explicit URIs) # Full paths from the document root will be passed through. # Used internally by +javascript_include_tag+ to build the script path. # # javascript_path "xmlhr" # => /assets/xmlhr.js # javascript_path "dir/xmlhr.js" # => /assets/dir/xmlhr.js # javascript_path "/dir/xmlhr" # => /dir/xmlhr.js # javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr # javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js def javascript_path(source, options = T.unsafe(nil)); end # Computes the full URL to a JavaScript asset in the public javascripts directory. # This will use +javascript_path+ internally, so most of their behaviors will be the same. # Since +javascript_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # javascript_url "js/xmlhr.js", host: "http://stage.example.com" # => http://stage.example.com/assets/js/xmlhr.js def javascript_url(source, options = T.unsafe(nil)); end # This is the entry point for all assets. # When using an asset pipeline gem (e.g. propshaft or sprockets-rails), the # behavior is "enhanced". You can bypass the asset pipeline by passing in # skip_pipeline: true 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 asset pipeline gems. # # asset_path("application.js") # => "/assets/application-60aa4fdc5cea14baf5400fba1abf4f2a46a5166bad4772b1effe341570f07de9.js" # asset_path('application.js', host: 'example.com') # => "//example.com/assets/application.js" # asset_path("application.js", host: 'example.com', protocol: 'https') # => "https://example.com/assets/application.js" # # === Without the asset pipeline (skip_pipeline: true) # # Accepts a type 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 # asset pipeline and all other behavior described. # # asset_path("http://www.example.com/js/xmlhr.js") # => "http://www.example.com/js/xmlhr.js" # # - All assets that begin with a forward slash are assumed to be full # URLs and will not be expanded. This will bypass the asset pipeline. # # asset_path("/foo.png") # => "/foo.png" # # - All blank strings will be returned immediately. This bypasses the # asset pipeline and all other behavior described. # # asset_path("") # => "" # # - If config.relative_url_root is specified, all assets will have that # root prepended. # # Rails.application.config.relative_url_root = "bar" # asset_path("foo.js", skip_pipeline: true) # => "bar/foo.js" # # - A different asset host can be specified via config.action_controller.asset_host # this is commonly used in conjunction with a CDN. # # Rails.application.config.action_controller.asset_host = "assets.example.com" # asset_path("foo.js", skip_pipeline: true) # => "http://assets.example.com/foo.js" # # - An extension name can be specified manually with extname. # # asset_path("foo", skip_pipeline: true, extname: ".js") # => "/foo.js" # asset_path("foo.css", skip_pipeline: true, extname: ".js") # => "/foo.css.js" # aliased to avoid conflicts with an asset_path named route # # @raise [ArgumentError] def path_to_asset(source, options = T.unsafe(nil)); end # Computes the path to an audio asset in the public audios directory. # Full paths from the document root will be passed through. # Used internally by +audio_tag+ to build the audio path. # # audio_path("horse") # => /audios/horse # audio_path("horse.wav") # => /audios/horse.wav # audio_path("sounds/horse.wav") # => /audios/sounds/horse.wav # audio_path("/sounds/horse.wav") # => /sounds/horse.wav # audio_path("http://www.example.com/sounds/horse.wav") # => http://www.example.com/sounds/horse.wav # aliased to avoid conflicts with an audio_path named route def path_to_audio(source, options = T.unsafe(nil)); end # Computes the path to a font asset. # Full paths from the document root will be passed through. # # font_path("font") # => /fonts/font # font_path("font.ttf") # => /fonts/font.ttf # font_path("dir/font.ttf") # => /fonts/dir/font.ttf # font_path("/dir/font.ttf") # => /dir/font.ttf # font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf # aliased to avoid conflicts with a font_path named route def path_to_font(source, options = T.unsafe(nil)); end # Computes the path to an image asset. # Full paths from the document root will be passed through. # Used internally by +image_tag+ to build the image path: # # image_path("edit") # => "/assets/edit" # image_path("edit.png") # => "/assets/edit.png" # image_path("icons/edit.png") # => "/assets/icons/edit.png" # image_path("/icons/edit.png") # => "/icons/edit.png" # image_path("http://www.example.com/img/edit.png") # => "http://www.example.com/img/edit.png" # # If you have images as application resources this method may conflict with their named routes. # The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and # plugin authors are encouraged to do so. # aliased to avoid conflicts with an image_path named route def path_to_image(source, options = T.unsafe(nil)); end # Computes the path to a JavaScript asset in the public javascripts directory. # If the +source+ filename has no extension, .js will be appended (except for explicit URIs) # Full paths from the document root will be passed through. # Used internally by +javascript_include_tag+ to build the script path. # # javascript_path "xmlhr" # => /assets/xmlhr.js # javascript_path "dir/xmlhr.js" # => /assets/dir/xmlhr.js # javascript_path "/dir/xmlhr" # => /dir/xmlhr.js # javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr # javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js # aliased to avoid conflicts with a javascript_path named route def path_to_javascript(source, options = T.unsafe(nil)); end # Computes the path to a stylesheet asset in the public stylesheets directory. # If the +source+ filename has no extension, .css will be appended (except for explicit URIs). # Full paths from the document root will be passed through. # Used internally by +stylesheet_link_tag+ to build the stylesheet path. # # stylesheet_path "style" # => /assets/style.css # stylesheet_path "dir/style.css" # => /assets/dir/style.css # stylesheet_path "/dir/style.css" # => /dir/style.css # stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style # stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css # aliased to avoid conflicts with a stylesheet_path named route def path_to_stylesheet(source, options = T.unsafe(nil)); end # Computes the path to a video asset in the public videos directory. # Full paths from the document root will be passed through. # Used internally by +video_tag+ to build the video path. # # video_path("hd") # => /videos/hd # video_path("hd.avi") # => /videos/hd.avi # video_path("trailers/hd.avi") # => /videos/trailers/hd.avi # video_path("/trailers/hd.avi") # => /trailers/hd.avi # video_path("http://www.example.com/vid/hd.avi") # => http://www.example.com/vid/hd.avi # aliased to avoid conflicts with a video_path named route def path_to_video(source, options = T.unsafe(nil)); end # Computes asset path to public directory. Plugins and # extensions can override this method to point to custom assets # or generate digested paths or query strings. def public_compute_asset_path(source, options = T.unsafe(nil)); end # Computes the path to a stylesheet asset in the public stylesheets directory. # If the +source+ filename has no extension, .css will be appended (except for explicit URIs). # Full paths from the document root will be passed through. # Used internally by +stylesheet_link_tag+ to build the stylesheet path. # # stylesheet_path "style" # => /assets/style.css # stylesheet_path "dir/style.css" # => /assets/dir/style.css # stylesheet_path "/dir/style.css" # => /dir/style.css # stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style # stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css def stylesheet_path(source, options = T.unsafe(nil)); end # Computes the full URL to a stylesheet asset in the public stylesheets directory. # This will use +stylesheet_path+ internally, so most of their behaviors will be the same. # Since +stylesheet_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # stylesheet_url "css/style.css", host: "http://stage.example.com" # => http://stage.example.com/assets/css/style.css def stylesheet_url(source, options = T.unsafe(nil)); end # Computes the full URL to an asset in the public directory. This # will use +asset_path+ internally, so most of their behaviors # will be the same. If +:host+ options is set, it overwrites global # +config.action_controller.asset_host+ setting. # # All other options provided are forwarded to +asset_path+ call. # # asset_url "application.js" # => http://example.com/assets/application.js # asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/assets/application.js # aliased to avoid conflicts with an asset_url named route def url_to_asset(source, options = T.unsafe(nil)); end # Computes the full URL to an audio asset in the public audios directory. # This will use +audio_path+ internally, so most of their behaviors will be the same. # Since +audio_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # audio_url "horse.wav", host: "http://stage.example.com" # => http://stage.example.com/audios/horse.wav # aliased to avoid conflicts with an audio_url named route def url_to_audio(source, options = T.unsafe(nil)); end # Computes the full URL to a font asset. # This will use +font_path+ internally, so most of their behaviors will be the same. # Since +font_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # font_url "font.ttf", host: "http://stage.example.com" # => http://stage.example.com/fonts/font.ttf # aliased to avoid conflicts with a font_url named route def url_to_font(source, options = T.unsafe(nil)); end # Computes the full URL to an image asset. # This will use +image_path+ internally, so most of their behaviors will be the same. # Since +image_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # image_url "edit.png", host: "http://stage.example.com" # => http://stage.example.com/assets/edit.png # aliased to avoid conflicts with an image_url named route def url_to_image(source, options = T.unsafe(nil)); end # Computes the full URL to a JavaScript asset in the public javascripts directory. # This will use +javascript_path+ internally, so most of their behaviors will be the same. # Since +javascript_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # javascript_url "js/xmlhr.js", host: "http://stage.example.com" # => http://stage.example.com/assets/js/xmlhr.js # aliased to avoid conflicts with a javascript_url named route def url_to_javascript(source, options = T.unsafe(nil)); end # Computes the full URL to a stylesheet asset in the public stylesheets directory. # This will use +stylesheet_path+ internally, so most of their behaviors will be the same. # Since +stylesheet_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # stylesheet_url "css/style.css", host: "http://stage.example.com" # => http://stage.example.com/assets/css/style.css # aliased to avoid conflicts with a stylesheet_url named route def url_to_stylesheet(source, options = T.unsafe(nil)); end # Computes the full URL to a video asset in the public videos directory. # This will use +video_path+ internally, so most of their behaviors will be the same. # Since +video_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # video_url "hd.avi", host: "http://stage.example.com" # => http://stage.example.com/videos/hd.avi # aliased to avoid conflicts with a video_url named route def url_to_video(source, options = T.unsafe(nil)); end # Computes the path to a video asset in the public videos directory. # Full paths from the document root will be passed through. # Used internally by +video_tag+ to build the video path. # # video_path("hd") # => /videos/hd # video_path("hd.avi") # => /videos/hd.avi # video_path("trailers/hd.avi") # => /videos/trailers/hd.avi # video_path("/trailers/hd.avi") # => /trailers/hd.avi # video_path("http://www.example.com/vid/hd.avi") # => http://www.example.com/vid/hd.avi def video_path(source, options = T.unsafe(nil)); end # Computes the full URL to a video asset in the public videos directory. # This will use +video_path+ internally, so most of their behaviors will be the same. # Since +video_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+ # options is set, it overwrites global +config.action_controller.asset_host+ setting. # # video_url "hd.avi", host: "http://stage.example.com" # => http://stage.example.com/videos/hd.avi def video_url(source, options = T.unsafe(nil)); end end ActionView::Helpers::AssetUrlHelper::ASSET_EXTENSIONS = T.let(T.unsafe(nil), Hash) # Maps asset types to public directory. ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES = T.let(T.unsafe(nil), Hash) ActionView::Helpers::AssetUrlHelper::URI_REGEXP = T.let(T.unsafe(nil), Regexp) module ActionView::Helpers::AtomFeedHelper # Adds easy defaults to writing Atom feeds with the Builder template engine (this does not work on ERB or any other # template languages). # # Full usage example: # # config/routes.rb: # Rails.application.routes.draw do # resources :posts # root to: "posts#index" # end # # app/controllers/posts_controller.rb: # class PostsController < ApplicationController # # GET /posts.html # # GET /posts.atom # def index # @posts = Post.all # # respond_to do |format| # format.html # format.atom # end # end # end # # app/views/posts/index.atom.builder: # atom_feed do |feed| # feed.title("My great blog!") # feed.updated(@posts[0].created_at) if @posts.length > 0 # # @posts.each do |post| # feed.entry(post) do |entry| # entry.title(post.title) # entry.content(post.body, type: 'html') # # entry.author do |author| # author.name("DHH") # end # end # end # end # # The options for atom_feed are: # # * :language: Defaults to "en-US". # * :root_url: The HTML alternative that this feed is doubling for. Defaults to / on the current host. # * :url: The URL for this feed. Defaults to the current URL. # * :id: The id for this feed. Defaults to "tag:localhost,2005:/posts", in this case. # * :schema_date: The date at which the tag scheme for the feed was first used. A good default is the year you # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified, # 2005 is used (as an "I don't care" value). # * :instruct: Hash of XML processing instructions in the form {target => {attribute => value, }} or {target => [{attribute => value, }, ]} # # Other namespaces can be added to the root element: # # app/views/posts/index.atom.builder: # atom_feed({'xmlns:app' => 'http://www.w3.org/2007/app', # 'xmlns:openSearch' => 'http://a9.com/-/spec/opensearch/1.1/'}) do |feed| # feed.title("My great blog!") # feed.updated((@posts.first.created_at)) # feed.tag!('openSearch:totalResults', 10) # # @posts.each do |post| # feed.entry(post) do |entry| # entry.title(post.title) # entry.content(post.body, type: 'html') # entry.tag!('app:edited', Time.now) # # entry.author do |author| # author.name("DHH") # end # end # end # end # # The Atom spec defines five elements (content rights title subtitle # summary) which may directly contain xhtml content if type: 'xhtml' # is specified as an attribute. If so, this helper will take care of # the enclosing div and xhtml namespace declaration. Example usage: # # entry.summary type: 'xhtml' do |xhtml| # xhtml.p pluralize(order.line_items.count, "line item") # xhtml.p "Shipped to #{order.address}" # xhtml.p "Paid by #{order.pay_type}" # end # # # atom_feed yields an +AtomFeedBuilder+ instance. Nested elements yield # an +AtomBuilder+ instance. def atom_feed(options = T.unsafe(nil), &block); end end class ActionView::Helpers::AtomFeedHelper::AtomBuilder # @return [AtomBuilder] a new instance of AtomBuilder def initialize(xml); end private # Delegate to xml builder, first wrapping the element in an xhtml # namespaced div element if the method and arguments indicate # that an xhtml_block? is desired. def method_missing(method, *arguments, &block); end # True if the method name matches one of the five elements defined # in the Atom spec as potentially containing XHTML content and # if type: 'xhtml' is, in fact, specified. # # @return [Boolean] def xhtml_block?(method, arguments); end end ActionView::Helpers::AtomFeedHelper::AtomBuilder::XHTML_TAG_NAMES = T.let(T.unsafe(nil), Set) class ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder < ::ActionView::Helpers::AtomFeedHelper::AtomBuilder # @return [AtomFeedBuilder] a new instance of AtomFeedBuilder def initialize(xml, view, feed_options = T.unsafe(nil)); end # Creates an entry tag for a specific record and prefills the id using class and id. # # Options: # # * :published: Time first published. Defaults to the created_at attribute on the record if one such exists. # * :updated: Time of update. Defaults to the updated_at attribute on the record if one such exists. # * :url: The URL for this entry or +false+ or +nil+ for not having a link tag. Defaults to the +polymorphic_url+ for the record. # * :id: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}" # * :type: The TYPE for this entry. Defaults to "text/html". def entry(record, options = T.unsafe(nil)); end # Accepts a Date or Time object and inserts it in the proper format. If +nil+ is passed, current time in UTC is used. def updated(date_or_time = T.unsafe(nil)); end end module ActionView::Helpers::CacheHelper # This helper exposes a method for caching fragments of a view # rather than an entire action or page. This technique is useful # caching pieces like menus, lists of new topics, static HTML # fragments, and so on. This method takes a block that contains # the content you wish to cache. # # The best way to use this is by doing recyclable key-based cache expiration # on top of a cache store like Memcached or Redis that'll automatically # kick out old entries. # # When using this method, you list the cache dependency as the name of the cache, like so: # # <% cache project do %> # All the topics on this project # <%= render project.topics %> # <% end %> # # This approach will assume that when a new topic is added, you'll touch # the project. The cache key generated from this call will be something like: # # views/template/action:7a1156131a6928cb0026877f8b749ac9/projects/123 # ^template path ^template tree digest ^class ^id # # This cache key is stable, but it's combined with a cache version derived from the project # record. When the project updated_at is touched, the #cache_version changes, even # if the key stays stable. This means that unlike a traditional key-based cache expiration # approach, you won't be generating cache trash, unused keys, simply because the dependent # record is updated. # # If your template cache depends on multiple sources (try to avoid this to keep things simple), # you can name all these dependencies as part of an array: # # <% cache [ project, current_user ] do %> # All the topics on this project # <%= render project.topics %> # <% end %> # # This will include both records as part of the cache key and updating either of them will # expire the cache. # # ==== \Template digest # # The template digest that's added to the cache key is computed by taking an MD5 of the # contents of the entire template file. This ensures that your caches will automatically # expire when you change the template file. # # Note that the MD5 is taken of the entire template file, not just what's within the # cache do/end call. So it's possible that changing something outside of that call will # still expire the cache. # # Additionally, the digestor will automatically look through your template file for # explicit and implicit dependencies, and include those as part of the digest. # # The digestor can be bypassed by passing skip_digest: true as an option to the cache call: # # <% cache project, skip_digest: true do %> # All the topics on this project # <%= render project.topics %> # <% end %> # # ==== Implicit dependencies # # Most template dependencies can be derived from calls to render in the template itself. # Here are some examples of render calls that Cache Digests knows how to decode: # # render partial: "comments/comment", collection: commentable.comments # render "comments/comments" # render 'comments/comments' # render('comments/comments') # # render "header" translates to render("comments/header") # # render(@topic) translates to render("topics/topic") # render(topics) translates to render("topics/topic") # render(message.topics) translates to render("topics/topic") # # It's not possible to derive all render calls like that, though. # Here are a few examples of things that can't be derived: # # render group_of_attachments # render @project.documents.where(published: true).order('created_at') # # You will have to rewrite those to the explicit form: # # render partial: 'attachments/attachment', collection: group_of_attachments # render partial: 'documents/document', collection: @project.documents.where(published: true).order('created_at') # # === Explicit dependencies # # Sometimes you'll have template dependencies that can't be derived at all. This is typically # the case when you have template rendering that happens in helpers. Here's an example: # # <%= render_sortable_todolists @project.todolists %> # # You'll need to use a special comment format to call those out: # # <%# Template Dependency: todolists/todolist %> # <%= render_sortable_todolists @project.todolists %> # # In some cases, like a single table inheritance setup, you might have # a bunch of explicit dependencies. Instead of writing every template out, # you can use a wildcard to match any template in a directory: # # <%# Template Dependency: events/* %> # <%= render_categorizable_events @person.events %> # # This marks every template in the directory as a dependency. To find those # templates, the wildcard path must be absolutely defined from app/views or paths # otherwise added with +prepend_view_path+ or +append_view_path+. # This way the wildcard for app/views/recordings/events would be recordings/events/* etc. # # The pattern used to match explicit dependencies is /# Template Dependency: (\S+)/, # so it's important that you type it out just so. # You can only declare one template dependency per line. # # === External dependencies # # If you use a helper method, for example, inside a cached block and # you then update that helper, you'll have to bump the cache as well. # It doesn't really matter how you do it, but the MD5 of the template file # must change. One recommendation is to simply be explicit in a comment, like: # # <%# Helper Dependency Updated: May 6, 2012 at 6pm %> # <%= some_helper_method(person) %> # # Now all you have to do is change that timestamp when the helper method changes. # # === Collection Caching # # When rendering a collection of objects that each use the same partial, a :cached # option can be passed. # # For collections rendered such: # # <%= render partial: 'projects/project', collection: @projects, cached: true %> # # The cached: true will make Action View's rendering read several templates # from cache at once instead of one call per template. # # Templates in the collection not already cached are written to cache. # # Works great alongside individual template fragment caching. # For instance if the template the collection renders is cached like: # # # projects/_project.html.erb # <% cache project do %> # <%# ... %> # <% end %> # # Any collection renders will find those cached templates when attempting # to read multiple templates at once. # # If your collection cache depends on multiple sources (try to avoid this to keep things simple), # you can name all these dependencies as part of a block that returns an array: # # <%= render partial: 'projects/project', collection: @projects, cached: -> project { [ project, current_user ] } %> # # This will include both records as part of the cache key and updating either of them will # expire the cache. def cache(name = T.unsafe(nil), options = T.unsafe(nil), &block); end # This helper returns the name of a cache key for a given fragment cache # call. By supplying skip_digest: true to cache, the digestion of cache # fragments can be manually bypassed. This is useful when cache fragments # cannot be manually expired unless you know the exact key which is the # case when using memcached. def cache_fragment_name(name = T.unsafe(nil), skip_digest: T.unsafe(nil), digest_path: T.unsafe(nil)); end # Cache fragments of a view if +condition+ is true # # <% cache_if admin?, project do %> # All the topics on this project # <%= render project.topics %> # <% end %> def cache_if(condition, name = T.unsafe(nil), options = T.unsafe(nil), &block); end # Cache fragments of a view unless +condition+ is true # # <% cache_unless admin?, project do %> # All the topics on this project # <%= render project.topics %> # <% end %> def cache_unless(condition, name = T.unsafe(nil), options = T.unsafe(nil), &block); end # Returns whether the current view fragment is within a +cache+ block. # # Useful when certain fragments aren't cacheable: # # <% cache project do %> # <% raise StandardError, "Caching private data!" if caching? %> # <% end %> # # @return [Boolean] def caching?; end def digest_path_from_template(template); end # Raises +UncacheableFragmentError+ when called from within a +cache+ block. # # Useful to denote helper methods that can't participate in fragment caching: # # def project_name_with_time(project) # uncacheable! # "#{project.name} - #{Time.now}" # end # # # Which will then raise if used within a +cache+ block: # <% cache project do %> # <%= project_name_with_time(project) %> # <% end %> # # @raise [UncacheableFragmentError] def uncacheable!; end private def fragment_for(name = T.unsafe(nil), options = T.unsafe(nil), &block); end def fragment_name_with_digest(name, digest_path); end def read_fragment_for(name, options); end def write_fragment_for(name, options); end end module ActionView::Helpers::CacheHelper::CachingRegistry extend ::ActionView::Helpers::CacheHelper::CachingRegistry # @return [Boolean] def caching?; end def track_caching; end end class ActionView::Helpers::CacheHelper::UncacheableFragmentError < ::StandardError; end # CaptureHelper exposes methods to let you extract generated markup which # can be used in other parts of a template or layout file. # # It provides a method to capture blocks into variables through capture and # a way to capture a block of markup for use in a layout through {content_for}[rdoc-ref:ActionView::Helpers::CaptureHelper#content_for]. module ActionView::Helpers::CaptureHelper # The capture method extracts part of a template as a String object. # You can then use this object anywhere in your templates, layout, or helpers. # # The capture method can be used in ERB templates... # # <% @greeting = capture do %> # Welcome to my shiny new web page! The date and time is # <%= Time.now %> # <% end %> # # ...and Builder (RXML) templates. # # @timestamp = capture do # "The current timestamp is #{Time.now}." # end # # You can then use that variable anywhere else. For example: # # # <%= @greeting %> # # <%= @greeting %> # # # # The return of capture is the string generated by the block. For Example: # # @greeting # => "Welcome to my shiny new web page! The date and time is 2018-09-06 11:09:16 -0500" def capture(*args); end # Calling content_for stores a block of markup in an identifier for later use. # In order to access this stored content in other templates, helper modules # or the layout, you would pass the identifier as an argument to content_for. # # Note: yield can still be used to retrieve the stored content, but calling # yield doesn't work in helper modules, while content_for does. # # <% content_for :not_authorized do %> # alert('You are not authorized to do that!') # <% end %> # # You can then use content_for :not_authorized anywhere in your templates. # # <%= content_for :not_authorized if current_user.nil? %> # # This is equivalent to: # # <%= yield :not_authorized if current_user.nil? %> # # content_for, however, can also be used in helper modules. # # module StorageHelper # def stored_content # content_for(:storage) || "Your storage is empty" # end # end # # This helper works just like normal helpers. # # <%= stored_content %> # # You can also use the yield syntax alongside an existing call to # yield in a layout. For example: # # <%# This is the layout %> # # # My Website # <%= yield :script %> # # # <%= yield %> # # # # And now, we'll create a view that has a content_for call that # creates the script identifier. # # <%# This is our view %> # Please login! # # <% content_for :script do %> # # <% end %> # # Then, in another view, you could to do something like this: # # <%= link_to 'Logout', action: 'logout', remote: true %> # # <% content_for :script do %> # <%= javascript_include_tag :defaults %> # <% end %> # # That will place +script+ tags for your default set of JavaScript files on the page; # this technique is useful if you'll only be using these scripts in a few views. # # Note that content_for concatenates (default) the blocks it is given for a particular # identifier in order. For example: # # <% content_for :navigation do %> #
  • <%= link_to 'Home', action: 'index' %>
  • # <% end %> # # And in another place: # # <% content_for :navigation do %> #
  • <%= link_to 'Login', action: 'login' %>
  • # <% end %> # # Then, in another template or layout, this code would render both links in order: # # # # If the flush parameter is +true+ content_for replaces the blocks it is given. For example: # # <% content_for :navigation do %> #
  • <%= link_to 'Home', action: 'index' %>
  • # <% end %> # # <%# Add some other content, or use a different template: %> # # <% content_for :navigation, flush: true do %> #
  • <%= link_to 'Login', action: 'login' %>
  • # <% end %> # # Then, in another template or layout, this code would render only the last link: # # # # Lastly, simple content can be passed as a parameter: # # <% content_for :script, javascript_include_tag(:defaults) %> # # WARNING: content_for is ignored in caches. So you shouldn't use it for elements that will be fragment cached. def content_for(name, content = T.unsafe(nil), options = T.unsafe(nil), &block); end # content_for? checks whether any content has been captured yet using content_for. # Useful to render parts of your layout differently based on what is in your views. # # <%# This is the layout %> # # # My Website # <%= yield :script %> # # # <%= yield %> # <%= yield :right_col %> # # # # @return [Boolean] def content_for?(name); end # The same as +content_for+ but when used with streaming flushes # straight back to the layout. In other words, if you want to # concatenate several times to the same buffer when rendering a given # template, you should use +content_for+, if not, use +provide+ to tell # the layout to stop looking for more contents. def provide(name, content = T.unsafe(nil), &block); end # Use an alternate output buffer for the duration of the block. # Defaults to a new empty string. def with_output_buffer(buf = T.unsafe(nil)); end end # This module keeps all methods and behavior in ActionView # that simply delegates to the controller. module ActionView::Helpers::ControllerHelper def action_name(*_arg0, &_arg1); end def assign_controller(controller); end def controller; end def controller=(_arg0); end def controller_name(*_arg0, &_arg1); end def controller_path(*_arg0, &_arg1); end def cookies(*_arg0, &_arg1); end def flash(*_arg0, &_arg1); end def headers(*_arg0, &_arg1); end def logger; end def params(*_arg0, &_arg1); end def request; end def request=(_arg0); end def request_forgery_protection_token(*_arg0, &_arg1); end # @return [Boolean] def respond_to?(method_name, include_private = T.unsafe(nil)); end def response(*_arg0, &_arg1); end def session(*_arg0, &_arg1); end end ActionView::Helpers::ControllerHelper::CONTROLLER_DELEGATES = T.let(T.unsafe(nil), Array) module ActionView::Helpers::CspHelper # Returns a meta tag "csp-nonce" with the per-session nonce value # for allowing inline # # +html_options+ may be a hash of attributes for the \ # # Instead of passing the content as an argument, you can also use a block # in which case, you pass your +html_options+ as the first parameter. # # <%= javascript_tag type: 'application/javascript' do -%> # alert('All is good') # <% end -%> # # If you have a content security policy enabled then you can add an automatic # nonce value by passing nonce: true as part of +html_options+. Example: # # <%= javascript_tag nonce: true do -%> # alert('All is good') # <% end -%> def javascript_tag(content_or_options_with_block = T.unsafe(nil), html_options = T.unsafe(nil), &block); end end ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP = T.let(T.unsafe(nil), Hash) # Provides methods for converting numbers into formatted strings. # Methods are provided for phone numbers, currency, percentage, # precision, positional notation, file size, and pretty printing. # # Most methods expect a +number+ argument, and will return it # unchanged if can't be converted into a valid number. module ActionView::Helpers::NumberHelper # Formats a +number+ into a currency string (e.g., $13.65). You # can customize the format in the +options+ hash. # # The currency unit and number formatting of the current locale will be used # unless otherwise specified in the provided options. No currency conversion # is performed. If the user is given a way to change their locale, they will # also be able to change the relative value of the currency displayed with # this helper. If your application will ever support multiple locales, you # may want to specify a constant :locale option or consider # using a library capable of currency conversion. # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :precision - Sets the level of precision (defaults # to 2). # * :unit - Sets the denomination of the currency # (defaults to "$"). # * :separator - Sets the separator between the units # (defaults to "."). # * :delimiter - Sets the thousands delimiter (defaults # to ","). # * :format - Sets the format for non-negative numbers # (defaults to "%u%n"). Fields are %u for the # currency, and %n for the number. # * :negative_format - Sets the format for negative # numbers (defaults to prepending a hyphen to the formatted # number given by :format). Accepts the same fields # than :format, except %n is here the # absolute value of the number. # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # * :strip_insignificant_zeros - If +true+ removes # insignificant zeros after the decimal separator (defaults to # +false+). # # ==== Examples # # number_to_currency(1234567890.50) # => $1,234,567,890.50 # number_to_currency(1234567890.506) # => $1,234,567,890.51 # number_to_currency(1234567890.506, precision: 3) # => $1,234,567,890.506 # number_to_currency(1234567890.506, locale: :fr) # => 1 234 567 890,51 € # number_to_currency("123a456") # => $123a456 # # number_to_currency("123a456", raise: true) # => InvalidNumberError # # number_to_currency(-0.456789, precision: 0) # # => "$0" # number_to_currency(-1234567890.50, negative_format: "(%u%n)") # # => ($1,234,567,890.50) # number_to_currency(1234567890.50, unit: "R$", separator: ",", delimiter: "") # # => R$1234567890,50 # number_to_currency(1234567890.50, unit: "R$", separator: ",", delimiter: "", format: "%n %u") # # => 1234567890,50 R$ # number_to_currency(1234567890.50, strip_insignificant_zeros: true) # # => "$1,234,567,890.5" def number_to_currency(number, options = T.unsafe(nil)); end # Pretty prints (formats and approximates) a number in a way it # is more readable by humans (e.g.: 1200000000 becomes "1.2 # Billion"). This is useful for numbers that can get very large # (and too hard to read). # # See number_to_human_size if you want to print a file # size. # # You can also define your own unit-quantifier names if you want # to use other decimal units (e.g.: 1500 becomes "1.5 # kilometers", 0.150 becomes "150 milliliters", etc). You may # define a wide range of unit quantifiers, even fractional ones # (centi, deci, mili, etc). # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :precision - Sets the precision of the number # (defaults to 3). # * :significant - If +true+, precision will be the number # of significant_digits. If +false+, the number of fractional # digits (defaults to +true+) # * :separator - Sets the separator between the # fractional and integer digits (defaults to "."). # * :delimiter - Sets the thousands delimiter (defaults # to ""). # * :strip_insignificant_zeros - If +true+ removes # insignificant zeros after the decimal separator (defaults to # +true+) # * :units - A Hash of unit quantifier names. Or a # string containing an i18n scope where to find this hash. It # might have the following keys: # * *integers*: :unit, :ten, # :hundred, :thousand, :million, # :billion, :trillion, # :quadrillion # * *fractionals*: :deci, :centi, # :mili, :micro, :nano, # :pico, :femto # * :format - Sets the format of the output string # (defaults to "%n %u"). The field types are: # * %u - The quantifier (ex.: 'thousand') # * %n - The number # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_to_human(123) # => "123" # number_to_human(1234) # => "1.23 Thousand" # number_to_human(12345) # => "12.3 Thousand" # number_to_human(1234567) # => "1.23 Million" # number_to_human(1234567890) # => "1.23 Billion" # number_to_human(1234567890123) # => "1.23 Trillion" # number_to_human(1234567890123456) # => "1.23 Quadrillion" # number_to_human(1234567890123456789) # => "1230 Quadrillion" # number_to_human(489939, precision: 2) # => "490 Thousand" # number_to_human(489939, precision: 4) # => "489.9 Thousand" # number_to_human(1234567, precision: 4, # significant: false) # => "1.2346 Million" # number_to_human(1234567, precision: 1, # separator: ',', # significant: false) # => "1,2 Million" # # number_to_human(500000000, precision: 5) # => "500 Million" # number_to_human(12345012345, significant: false) # => "12.345 Billion" # # Non-significant zeros after the decimal separator are stripped # out by default (set :strip_insignificant_zeros to # +false+ to change that): # # number_to_human(12.00001) # => "12" # number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0" # # ==== Custom Unit Quantifiers # # You can also use your own custom unit quantifiers: # number_to_human(500000, units: {unit: "ml", thousand: "lt"}) # => "500 lt" # # If in your I18n locale you have: # distance: # centi: # one: "centimeter" # other: "centimeters" # unit: # one: "meter" # other: "meters" # thousand: # one: "kilometer" # other: "kilometers" # billion: "gazillion-distance" # # Then you could do: # # number_to_human(543934, units: :distance) # => "544 kilometers" # number_to_human(54393498, units: :distance) # => "54400 kilometers" # number_to_human(54393498000, units: :distance) # => "54.4 gazillion-distance" # number_to_human(343, units: :distance, precision: 1) # => "300 meters" # number_to_human(1, units: :distance) # => "1 meter" # number_to_human(0.34, units: :distance) # => "34 centimeters" def number_to_human(number, options = T.unsafe(nil)); end # Formats the bytes in +number+ into a more understandable # representation (e.g., giving it 1500 yields 1.46 KB). This # method is useful for reporting file sizes to users. You can # customize the format in the +options+ hash. # # See number_to_human if you want to pretty-print a # generic number. # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :precision - Sets the precision of the number # (defaults to 3). # * :significant - If +true+, precision will be the number # of significant_digits. If +false+, the number of fractional # digits (defaults to +true+) # * :separator - Sets the separator between the # fractional and integer digits (defaults to "."). # * :delimiter - Sets the thousands delimiter (defaults # to ""). # * :strip_insignificant_zeros - If +true+ removes # insignificant zeros after the decimal separator (defaults to # +true+) # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_to_human_size(123) # => 123 Bytes # number_to_human_size(1234) # => 1.21 KB # number_to_human_size(12345) # => 12.1 KB # number_to_human_size(1234567) # => 1.18 MB # number_to_human_size(1234567890) # => 1.15 GB # number_to_human_size(1234567890123) # => 1.12 TB # number_to_human_size(1234567890123456) # => 1.1 PB # number_to_human_size(1234567890123456789) # => 1.07 EB # number_to_human_size(1234567, precision: 2) # => 1.2 MB # number_to_human_size(483989, precision: 2) # => 470 KB # number_to_human_size(1234567, precision: 2, separator: ',') # => 1,2 MB # number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB" # number_to_human_size(524288000, precision: 5) # => "500 MB" def number_to_human_size(number, options = T.unsafe(nil)); end # Formats a +number+ as a percentage string (e.g., 65%). You can # customize the format in the +options+ hash. # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :precision - Sets the precision of the number # (defaults to 3). # * :significant - If +true+, precision will be the number # of significant_digits. If +false+, the number of fractional # digits (defaults to +false+). # * :separator - Sets the separator between the # fractional and integer digits (defaults to "."). # * :delimiter - Sets the thousands delimiter (defaults # to ""). # * :strip_insignificant_zeros - If +true+ removes # insignificant zeros after the decimal separator (defaults to # +false+). # * :format - Specifies the format of the percentage # string The number field is %n (defaults to "%n%"). # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_to_percentage(100) # => 100.000% # number_to_percentage("98") # => 98.000% # number_to_percentage(100, precision: 0) # => 100% # number_to_percentage(1000, delimiter: '.', separator: ',') # => 1.000,000% # number_to_percentage(302.24398923423, precision: 5) # => 302.24399% # number_to_percentage(1000, locale: :fr) # => 1 000,000% # number_to_percentage("98a") # => 98a% # number_to_percentage(100, format: "%n %") # => 100.000 % # # number_to_percentage("98a", raise: true) # => InvalidNumberError def number_to_percentage(number, options = T.unsafe(nil)); end # Formats a +number+ into a phone number (US by default e.g., (555) # 123-9876). You can customize the format in the +options+ hash. # # ==== Options # # * :area_code - Adds parentheses around the area code. # * :delimiter - Specifies the delimiter to use # (defaults to "-"). # * :extension - Specifies an extension to add to the # end of the generated number. # * :country_code - Sets the country code for the phone # number. # * :pattern - Specifies how the number is divided into three # groups with the custom regexp to override the default format. # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_to_phone(5551234) # => 555-1234 # number_to_phone("5551234") # => 555-1234 # number_to_phone(1235551234) # => 123-555-1234 # number_to_phone(1235551234, area_code: true) # => (123) 555-1234 # number_to_phone(1235551234, delimiter: " ") # => 123 555 1234 # number_to_phone(1235551234, area_code: true, extension: 555) # => (123) 555-1234 x 555 # number_to_phone(1235551234, country_code: 1) # => +1-123-555-1234 # number_to_phone("123a456") # => 123a456 # number_to_phone("1234a567", raise: true) # => InvalidNumberError # # number_to_phone(1235551234, country_code: 1, extension: 1343, delimiter: ".") # # => +1.123.555.1234 x 1343 # # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true) # # => "(755) 6123-4567" # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/) # # => "133-1234-5678" def number_to_phone(number, options = T.unsafe(nil)); end # Formats a +number+ with grouped thousands using +delimiter+ # (e.g., 12,324). You can customize the format in the +options+ # hash. # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :delimiter - Sets the thousands delimiter (defaults # to ","). # * :separator - Sets the separator between the # fractional and integer digits (defaults to "."). # * :delimiter_pattern - Sets a custom regular expression used for # deriving the placement of delimiter. Helpful when using currency formats # like INR. # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_with_delimiter(12345678) # => 12,345,678 # number_with_delimiter("123456") # => 123,456 # number_with_delimiter(12345678.05) # => 12,345,678.05 # number_with_delimiter(12345678, delimiter: ".") # => 12.345.678 # number_with_delimiter(12345678, delimiter: ",") # => 12,345,678 # number_with_delimiter(12345678.05, separator: " ") # => 12,345,678 05 # number_with_delimiter(12345678.05, locale: :fr) # => 12 345 678,05 # number_with_delimiter("112a") # => 112a # number_with_delimiter(98765432.98, delimiter: " ", separator: ",") # # => 98 765 432,98 # # number_with_delimiter("123456.78", # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) # => "1,23,456.78" # # number_with_delimiter("112a", raise: true) # => raise InvalidNumberError def number_with_delimiter(number, options = T.unsafe(nil)); end # Formats a +number+ with the specified level of # :precision (e.g., 112.32 has a precision of 2 if # +:significant+ is +false+, and 5 if +:significant+ is +true+). # You can customize the format in the +options+ hash. # # ==== Options # # * :locale - Sets the locale to be used for formatting # (defaults to current locale). # * :precision - Sets the precision of the number # (defaults to 3). # * :significant - If +true+, precision will be the number # of significant_digits. If +false+, the number of fractional # digits (defaults to +false+). # * :separator - Sets the separator between the # fractional and integer digits (defaults to "."). # * :delimiter - Sets the thousands delimiter (defaults # to ""). # * :strip_insignificant_zeros - If +true+ removes # insignificant zeros after the decimal separator (defaults to # +false+). # * :raise - If true, raises +InvalidNumberError+ when # the argument is invalid. # # ==== Examples # # number_with_precision(111.2345) # => 111.235 # number_with_precision(111.2345, precision: 2) # => 111.23 # number_with_precision(13, precision: 5) # => 13.00000 # number_with_precision(389.32314, precision: 0) # => 389 # number_with_precision(111.2345, significant: true) # => 111 # number_with_precision(111.2345, precision: 1, significant: true) # => 100 # number_with_precision(13, precision: 5, significant: true) # => 13.000 # number_with_precision(111.234, locale: :fr) # => 111,234 # # number_with_precision(13, precision: 5, significant: true, strip_insignificant_zeros: true) # # => 13 # # number_with_precision(389.32314, precision: 4, significant: true) # => 389.3 # number_with_precision(1111.2345, precision: 2, separator: ',', delimiter: '.') # # => 1.111,23 def number_with_precision(number, options = T.unsafe(nil)); end private def delegate_number_helper_method(method, number, options); end def escape_units(units); end def escape_unsafe_options(options); end # @raise [InvalidNumberError] def parse_float(number, raise_error); end # @return [Boolean] def valid_float?(number); end # @raise [InvalidNumberError] def wrap_with_output_safety_handling(number, raise_on_invalid, &block); end end # Raised when argument +number+ param given to the helpers is invalid and # the option +:raise+ is set to +true+. class ActionView::Helpers::NumberHelper::InvalidNumberError < ::StandardError # @return [InvalidNumberError] a new instance of InvalidNumberError def initialize(number); end # Returns the value of attribute number. def number; end # Sets the attribute number # # @param value the value to set the attribute number to. def number=(_arg0); end end module ActionView::Helpers::OutputSafetyHelper # This method outputs without escaping a string. Since escaping tags is # now default, this can be used when you don't want Rails to automatically # escape tags. This is not recommended if the data is coming from the user's # input. # # For example: # # raw @user.name # # => 'Jimmy Tables' def raw(stringish); end # This method returns an HTML safe string similar to what Array#join # would return. The array is flattened, and all items, including # the supplied separator, are HTML escaped unless they are HTML # safe, and the returned string is marked as HTML safe. # # safe_join([raw("

    foo

    "), "

    bar

    "], "
    ") # # => "

    foo

    <br /><p>bar</p>" # # safe_join([raw("

    foo

    "), raw("

    bar

    ")], raw("
    ")) # # => "

    foo


    bar

    " def safe_join(array, sep = T.unsafe(nil)); end # Converts the array to a comma-separated sentence where the last element is # joined by the connector word. This is the html_safe-aware version of # ActiveSupport's {Array#to_sentence}[https://api.rubyonrails.org/classes/Array.html#method-i-to_sentence]. def to_sentence(array, options = T.unsafe(nil)); end end # = Action View Rendering # # Implements methods that allow rendering from a view context. # In order to use this module, all you need is to implement # view_renderer that returns an ActionView::Renderer object. module ActionView::Helpers::RenderingHelper # Overrides _layout_for in the context object so it supports the case a block is # passed to a partial. Returns the contents that are yielded to a layout, given a # name or a block. # # You can think of a layout as a method that is called with a block. If the user calls # yield :some_name, the block, by default, returns content_for(:some_name). # If the user calls simply +yield+, the default block returns content_for(:layout). # # The user can override this default by passing a block to the layout: # # # The template # <%= render layout: "my_layout" do %> # Content # <% end %> # # # The layout # # <%= yield %> # # # In this case, instead of the default block, which would return content_for(:layout), # this method returns the block that was passed in to render :layout, and the response # would be # # # Content # # # Finally, the block can take block arguments, which can be passed in by +yield+: # # # The template # <%= render layout: "my_layout" do |customer| %> # Hello <%= customer.name %> # <% end %> # # # The layout # # <%= yield Struct.new(:name).new("David") %> # # # In this case, the layout would receive the block passed into render :layout, # and the struct specified would be passed into the block as an argument. The result # would be # # # Hello David # def _layout_for(*args, &block); end # Returns the result of a render that's dictated by the options hash. The primary options are: # # * :partial - See ActionView::PartialRenderer. # * :file - Renders an explicit template file (this used to be the old default), add +:locals+ to pass in those. # * :inline - Renders an inline template similar to how it's done in the controller. # * :plain - Renders the text passed in out. Setting the content # type as text/plain. # * :html - Renders the HTML safe string passed in out, otherwise # performs HTML escape on the string first. Setting the content type as # text/html. # * :body - Renders the text passed in, and inherits the content # type of text/plain from ActionDispatch::Response object. # # If no options hash is passed or if :update is specified, then: # # If an object responding to +render_in+ is passed, +render_in+ is called on the object, # passing in the current view context. # # Otherwise, a partial is rendered using the second parameter as the locals hash. def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end end # The SanitizeHelper module provides a set of methods for scrubbing text of undesired HTML elements. # These helper methods extend Action View making them callable within your template files. module ActionView::Helpers::SanitizeHelper extend ::ActiveSupport::Concern mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods # Sanitizes HTML input, stripping all but known-safe tags and attributes. # # It also strips href/src attributes with unsafe protocols like # javascript:, while also protecting against attempts to use Unicode, # ASCII, and hex character references to work around these protocol filters. # All special characters will be escaped. # # The default sanitizer is Rails::Html::SafeListSanitizer. See {Rails HTML # Sanitizers}[https://github.com/rails/rails-html-sanitizer] for more information. # # Custom sanitization rules can also be provided. # # Please note that sanitizing user-provided text does not guarantee that the # resulting markup is valid or even well-formed. # # ==== Options # # * :tags - An array of allowed tags. # * :attributes - An array of allowed attributes. # * :scrubber - A {Rails::Html scrubber}[https://github.com/rails/rails-html-sanitizer] # or {Loofah::Scrubber}[https://github.com/flavorjones/loofah] object that # defines custom sanitization rules. A custom scrubber takes precedence over # custom tags and attributes. # # ==== Examples # # Normal use: # # <%= sanitize @comment.body %> # # Providing custom lists of permitted tags and attributes: # # <%= sanitize @comment.body, tags: %w(strong em a), attributes: %w(href) %> # # Providing a custom Rails::Html scrubber: # # class CommentScrubber < Rails::Html::PermitScrubber # def initialize # super # self.tags = %w( form script comment blockquote ) # self.attributes = %w( style ) # end # # def skip_node?(node) # node.text? # end # end # # <%= sanitize @comment.body, scrubber: CommentScrubber.new %> # # See {Rails HTML Sanitizer}[https://github.com/rails/rails-html-sanitizer] for # documentation about Rails::Html scrubbers. # # Providing a custom Loofah::Scrubber: # # scrubber = Loofah::Scrubber.new do |node| # node.remove if node.name == 'script' # end # # <%= sanitize @comment.body, scrubber: scrubber %> # # See {Loofah's documentation}[https://github.com/flavorjones/loofah] for more # information about defining custom Loofah::Scrubber objects. # # To set the default allowed tags or attributes across your application: # # # In config/application.rb # config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a'] # config.action_view.sanitized_allowed_attributes = ['href', 'title'] def sanitize(html, options = T.unsafe(nil)); end # Sanitizes a block of CSS code. Used by +sanitize+ when it comes across a style attribute. def sanitize_css(style); end # Strips all link tags from +html+ leaving just the link text. # # strip_links('Ruby on Rails') # # => Ruby on Rails # # strip_links('Please e-mail me at me@email.com.') # # => Please e-mail me at me@email.com. # # strip_links('Blog: Visit.') # # => Blog: Visit. # # strip_links('<malformed & link') # # => <malformed & link def strip_links(html); end # Strips all HTML tags from +html+, including comments and special characters. # # strip_tags("Strip these tags!") # # => Strip these tags! # # strip_tags("Bold no more! See more here...") # # => Bold no more! See more here... # # strip_tags("
    Welcome to my website!
    ") # # => Welcome to my website! # # strip_tags("> A quote from Smith & Wesson") # # => > A quote from Smith & Wesson def strip_tags(html); end end module ActionView::Helpers::SanitizeHelper::ClassMethods # Gets the Rails::Html::FullSanitizer instance used by +strip_tags+. Replace with # any object that responds to +sanitize+. # # class Application < Rails::Application # config.action_view.full_sanitizer = MySpecialSanitizer.new # end def full_sanitizer; end # Sets the attribute full_sanitizer # # @param value the value to set the attribute full_sanitizer to. def full_sanitizer=(_arg0); end # Gets the Rails::Html::LinkSanitizer instance used by +strip_links+. # Replace with any object that responds to +sanitize+. # # class Application < Rails::Application # config.action_view.link_sanitizer = MySpecialSanitizer.new # end def link_sanitizer; end # Sets the attribute link_sanitizer # # @param value the value to set the attribute link_sanitizer to. def link_sanitizer=(_arg0); end # Gets the Rails::Html::SafeListSanitizer instance used by sanitize and +sanitize_css+. # Replace with any object that responds to +sanitize+. # # class Application < Rails::Application # config.action_view.safe_list_sanitizer = MySpecialSanitizer.new # end def safe_list_sanitizer; end # Sets the attribute safe_list_sanitizer # # @param value the value to set the attribute safe_list_sanitizer to. def safe_list_sanitizer=(_arg0); end def sanitized_allowed_attributes; end def sanitized_allowed_attributes=(attributes); end def sanitized_allowed_css_keywords; end def sanitized_allowed_css_keywords=(_); end def sanitized_allowed_css_properties; end def sanitized_allowed_css_properties=(_); end def sanitized_allowed_protocols; end def sanitized_allowed_protocols=(_); end def sanitized_allowed_tags; end def sanitized_allowed_tags=(tags); end def sanitized_bad_tags; end def sanitized_bad_tags=(_); end def sanitized_protocol_separator; end def sanitized_protocol_separator=(_); end def sanitized_shorthand_css_properties; end def sanitized_shorthand_css_properties=(_); end def sanitized_uri_attributes; end def sanitized_uri_attributes=(_); end def sanitizer_vendor; end private def deprecate_option(name); end end # Provides methods to generate HTML tags programmatically both as a modern # HTML5 compliant builder style and legacy XHTML compliant tags. module ActionView::Helpers::TagHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper # Returns a CDATA section with the given +content+. CDATA sections # are used to escape blocks of text containing characters which would # otherwise be recognized as markup. CDATA sections begin with the string # and end with (and may not contain) the string ]]>. # # cdata_section("") # # => ]]> # # cdata_section(File.read("hello_world.txt")) # # => # # cdata_section("hello]]>world") # # => world]]> def cdata_section(content); end # Returns a string of tokens built from +args+. # # ==== Examples # token_list("foo", "bar") # # => "foo bar" # token_list("foo", "foo bar") # # => "foo bar" # token_list({ foo: true, bar: false }) # # => "foo" # token_list(nil, false, 123, "", "foo", { bar: true }) # # => "123 foo bar" def class_names(*args); end # Returns an HTML block tag of type +name+ surrounding the +content+. Add # HTML attributes by passing an attributes hash to +options+. # Instead of passing the content as an argument, you can also use a block # in which case, you pass your +options+ as the second parameter. # Set escape to false to disable escaping. # Note: this is legacy syntax, see +tag+ method description for details. # # ==== Options # The +options+ hash can be used with attributes with no value like (disabled and # readonly), which you can give a value of true in the +options+ hash. You can use # symbols or strings for the attribute names. # # ==== Examples # content_tag(:p, "Hello world!") # # =>

    Hello world!

    # content_tag(:div, content_tag(:p, "Hello world!"), class: "strong") # # =>

    Hello world!

    # content_tag(:div, "Hello world!", class: ["strong", "highlight"]) # # =>
    Hello world!
    # content_tag(:div, "Hello world!", class: ["strong", { highlight: current_user.admin? }]) # # =>
    Hello world!
    # content_tag("select", options, multiple: true) # # => # # <%= content_tag :div, class: "strong" do -%> # Hello world! # <% end -%> # # =>
    Hello world!
    def content_tag(name, content_or_options_with_block = T.unsafe(nil), options = T.unsafe(nil), escape = T.unsafe(nil), &block); end # Returns an escaped version of +html+ without affecting existing escaped entities. # # escape_once("1 < 2 & 3") # # => "1 < 2 & 3" # # escape_once("<< Accept & Checkout") # # => "<< Accept & Checkout" def escape_once(html); end # Returns an HTML tag. # # === Building HTML tags # # Builds HTML5 compliant tags with a tag proxy. Every tag can be built with: # # tag.(optional content, options) # # where tag name can be e.g. br, div, section, article, or any tag really. # # ==== Passing content # # Tags can pass content to embed within it: # # tag.h1 'All titles fit to print' # =>

    All titles fit to print

    # # tag.div tag.p('Hello world!') # =>

    Hello world!

    # # Content can also be captured with a block, which is useful in templates: # # <%= tag.p do %> # The next great American novel starts here. # <% end %> # # =>

    The next great American novel starts here.

    # # ==== Options # # Use symbol keyed options to add attributes to the generated tag. # # tag.section class: %w( kitties puppies ) # # =>
    # # tag.section id: dom_id(@post) # # =>
    # # Pass +true+ for any attributes that can render with no values, like +disabled+ and +readonly+. # # tag.input type: 'text', disabled: true # # => # # HTML5 data-* and aria-* attributes can be set with a # single +data+ or +aria+ key pointing to a hash of sub-attributes. # # To play nicely with JavaScript conventions, sub-attributes are dasherized. # # tag.article data: { user_id: 123 } # # =>
    # # Thus data-user-id can be accessed as dataset.userId. # # Data attribute values are encoded to JSON, with the exception of strings, symbols, and # BigDecimals. # This may come in handy when using jQuery's HTML5-aware .data() # from 1.4.3. # # tag.div data: { city_state: %w( Chicago IL ) } # # =>
    # # The generated tag names and attributes are escaped by default. This can be disabled using # +escape+. # # tag.img src: 'open & shut.png' # # => # # tag.img src: 'open & shut.png', escape: false # # => # # The tag builder respects # {HTML5 void elements}[https://www.w3.org/TR/html5/syntax.html#void-elements] # if no content is passed, and omits closing tags for those elements. # # # A standard element: # tag.div # =>
    # # # A void element: # tag.br # =>
    # # === Building HTML attributes # # Transforms a Hash into HTML attributes, ready to be interpolated into # ERB. Includes or omits boolean attributes based on their truthiness. # Transforms keys nested within # aria: or data: objects into aria- and data- # prefixed attributes: # # > # # => # # # # => # # === Legacy syntax # # The following format is for legacy syntax support. It will be deprecated in future versions of Rails. # # tag(name, options = nil, open = false, escape = true) # # It returns an empty HTML tag of type +name+ which by default is XHTML # compliant. Set +open+ to true to create an open tag compatible # with HTML 4.0 and below. Add HTML attributes by passing an attributes # hash to +options+. Set +escape+ to false to disable attribute value # escaping. # # ==== Options # # You can use symbols or strings for the attribute names. # # Use +true+ with boolean attributes that can render with no value, like # +disabled+ and +readonly+. # # HTML5 data-* attributes can be set with a single +data+ key # pointing to a hash of sub-attributes. # # ==== Examples # # tag("br") # # =>
    # # tag("br", nil, true) # # =>
    # # tag("input", type: 'text', disabled: true) # # => # # tag("input", type: 'text', class: ["strong", "highlight"]) # # => # # tag("img", src: "open & shut.png") # # => # # tag("img", { src: "open & shut.png" }, false, false) # # => # # tag("div", data: { name: 'Stephen', city_state: %w(Chicago IL) }) # # =>
    # # tag("div", class: { highlight: current_user.admin? }) # # =>
    def tag(name = T.unsafe(nil), options = T.unsafe(nil), open = T.unsafe(nil), escape = T.unsafe(nil)); end # Returns a string of tokens built from +args+. # # ==== Examples # token_list("foo", "bar") # # => "foo bar" # token_list("foo", "foo bar") # # => "foo bar" # token_list({ foo: true, bar: false }) # # => "foo" # token_list(nil, false, 123, "", "foo", { bar: true }) # # => "123 foo bar" def token_list(*args); end private def build_tag_values(*args); end def tag_builder; end class << self def build_tag_values(*args); end end end ActionView::Helpers::TagHelper::ARIA_PREFIXES = T.let(T.unsafe(nil), Set) ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES = T.let(T.unsafe(nil), Set) ActionView::Helpers::TagHelper::DATA_PREFIXES = T.let(T.unsafe(nil), Set) ActionView::Helpers::TagHelper::PRE_CONTENT_STRINGS = T.let(T.unsafe(nil), Hash) ActionView::Helpers::TagHelper::TAG_TYPES = T.let(T.unsafe(nil), Hash) class ActionView::Helpers::TagHelper::TagBuilder include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper # @return [TagBuilder] a new instance of TagBuilder def initialize(view_context); end # Transforms a Hash into HTML Attributes, ready to be interpolated into # ERB. # # > # # => def attributes(attributes); end def boolean_tag_option(key); end def content_tag_string(name, content, options, escape = T.unsafe(nil)); end def p(*arguments, **options, &block); end def tag_option(key, value, escape); end def tag_options(options, escape = T.unsafe(nil)); end def tag_string(name, content = T.unsafe(nil), **options, &block); end private def handle_deprecated_escape_options(options); end def method_missing(called, *args, **options, &block); end def prefix_tag_option(prefix, key, value, escape); end # @return [Boolean] def respond_to_missing?(*args); end end ActionView::Helpers::TagHelper::TagBuilder::HTML_VOID_ELEMENTS = T.let(T.unsafe(nil), Set) ActionView::Helpers::TagHelper::TagBuilder::SVG_SELF_CLOSING_ELEMENTS = T.let(T.unsafe(nil), Set) module ActionView::Helpers::Tags extend ::ActiveSupport::Autoload end class ActionView::Helpers::Tags::Base include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper include ::ActionView::Helpers::UrlHelper include ::ActionView::Helpers::SanitizeHelper include ::ActionView::Helpers::TextHelper include ::ActionView::Helpers::FormTagHelper include ::ActionView::Helpers::ActiveModelInstanceTag include ::ActionView::Helpers::FormOptionsHelper extend ::ActionView::Helpers::UrlHelper::ClassMethods extend ::ActionView::Helpers::SanitizeHelper::ClassMethods # @return [Base] a new instance of Base def initialize(object_name, method_name, template_object, options = T.unsafe(nil)); end # Returns the value of attribute object. def object; end # This is what child classes implement. # # @raise [NotImplementedError] def render; end private def add_default_name_and_id(options); end def add_default_name_and_id_for_value(tag_value, options); end def add_options(option_tags, options, value = T.unsafe(nil)); end # @return [Boolean] def generate_ids?; end def name_and_id_index(options); end # @return [Boolean] def placeholder_required?(html_options); end def retrieve_autoindex(pre_match); end def retrieve_object(object); end def sanitized_method_name; end def sanitized_value(value); end def select_content_tag(option_tags, options, html_options); end def tag_id(index = T.unsafe(nil), namespace = T.unsafe(nil)); end def tag_name(multiple = T.unsafe(nil), index = T.unsafe(nil)); end def value; end def value_before_type_cast; end # @return [Boolean] def value_came_from_user?; end end class ActionView::Helpers::Tags::CheckBox < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::Checkable # @return [CheckBox] a new instance of CheckBox def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options); end def render; end private # @return [Boolean] def checked?(value); end def hidden_field_for_checkbox(options); end end module ActionView::Helpers::Tags::Checkable # @return [Boolean] def input_checked?(options); end end class ActionView::Helpers::Tags::CollectionCheckBoxes < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::CollectionHelpers def render(&block); end private def hidden_field_name; end def render_component(builder); end end class ActionView::Helpers::Tags::CollectionCheckBoxes::CheckBoxBuilder < ::ActionView::Helpers::Tags::CollectionHelpers::Builder def check_box(extra_html_options = T.unsafe(nil)); end end module ActionView::Helpers::Tags::CollectionHelpers def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options); end private # Generate default options for collection helpers, such as :checked and # :disabled. def default_html_options_for_collection(item, value); end def hidden_field; end def hidden_field_name; end def instantiate_builder(builder_class, item, value, text, html_options); end def render_collection; end def render_collection_for(builder_class, &block); end def sanitize_attribute_name(value); end end class ActionView::Helpers::Tags::CollectionHelpers::Builder # @return [Builder] a new instance of Builder def initialize(template_object, object_name, method_name, object, sanitized_attribute_name, text, value, input_html_options); end def label(label_html_options = T.unsafe(nil), &block); end # Returns the value of attribute object. def object; end # Returns the value of attribute text. def text; end # Returns the value of attribute value. def value; end end class ActionView::Helpers::Tags::CollectionRadioButtons < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::CollectionHelpers def render(&block); end private def render_component(builder); end end class ActionView::Helpers::Tags::CollectionRadioButtons::RadioButtonBuilder < ::ActionView::Helpers::Tags::CollectionHelpers::Builder def radio_button(extra_html_options = T.unsafe(nil)); end end class ActionView::Helpers::Tags::CollectionSelect < ::ActionView::Helpers::Tags::Base # @return [CollectionSelect] a new instance of CollectionSelect def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options); end def render; end end class ActionView::Helpers::Tags::ColorField < ::ActionView::Helpers::Tags::TextField def render; end private def validate_color_string(string); end end class ActionView::Helpers::Tags::DateField < ::ActionView::Helpers::Tags::DatetimeField private def format_date(value); end end class ActionView::Helpers::Tags::DateSelect < ::ActionView::Helpers::Tags::Base # @return [DateSelect] a new instance of DateSelect def initialize(object_name, method_name, template_object, options, html_options); end def render; end private def datetime_selector(options, html_options); end def default_datetime(options); end def select_type; end class << self def select_type; end end end class ActionView::Helpers::Tags::DatetimeField < ::ActionView::Helpers::Tags::TextField def render; end private def datetime_value(value); end # @raise [NotImplementedError] def format_date(value); end end class ActionView::Helpers::Tags::DatetimeLocalField < ::ActionView::Helpers::Tags::DatetimeField private def format_date(value); end class << self def field_type; end end end class ActionView::Helpers::Tags::DatetimeSelect < ::ActionView::Helpers::Tags::DateSelect; end class ActionView::Helpers::Tags::EmailField < ::ActionView::Helpers::Tags::TextField; end class ActionView::Helpers::Tags::FileField < ::ActionView::Helpers::Tags::TextField def render; end private def hidden_field_for_multiple_file(options); end end class ActionView::Helpers::Tags::GroupedCollectionSelect < ::ActionView::Helpers::Tags::Base # @return [GroupedCollectionSelect] a new instance of GroupedCollectionSelect def initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options); end def render; end end class ActionView::Helpers::Tags::HiddenField < ::ActionView::Helpers::Tags::TextField def render; end end class ActionView::Helpers::Tags::Label < ::ActionView::Helpers::Tags::Base # @return [Label] a new instance of Label def initialize(object_name, method_name, template_object, content_or_options = T.unsafe(nil), options = T.unsafe(nil)); end def render(&block); end private def render_component(builder); end end class ActionView::Helpers::Tags::Label::LabelBuilder # @return [LabelBuilder] a new instance of LabelBuilder def initialize(template_object, object_name, method_name, object, tag_value); end # Returns the value of attribute object. def object; end def to_s; end def translation; end end class ActionView::Helpers::Tags::MonthField < ::ActionView::Helpers::Tags::DatetimeField private def format_date(value); end end class ActionView::Helpers::Tags::NumberField < ::ActionView::Helpers::Tags::TextField def render; end end class ActionView::Helpers::Tags::PasswordField < ::ActionView::Helpers::Tags::TextField def render; end end module ActionView::Helpers::Tags::Placeholderable def initialize(*_arg0); end end class ActionView::Helpers::Tags::RadioButton < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::Checkable # @return [RadioButton] a new instance of RadioButton def initialize(object_name, method_name, template_object, tag_value, options); end def render; end private # @return [Boolean] def checked?(value); end end class ActionView::Helpers::Tags::RangeField < ::ActionView::Helpers::Tags::NumberField; end class ActionView::Helpers::Tags::SearchField < ::ActionView::Helpers::Tags::TextField def render; end end class ActionView::Helpers::Tags::Select < ::ActionView::Helpers::Tags::Base # @return [Select] a new instance of Select def initialize(object_name, method_name, template_object, choices, options, html_options); end def render; end private # Grouped choices look like this: # # [nil, []] # { nil => [] } # # @return [Boolean] def grouped_choices?; end end class ActionView::Helpers::Tags::TelField < ::ActionView::Helpers::Tags::TextField; end class ActionView::Helpers::Tags::TextArea < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::Placeholderable def render; end end class ActionView::Helpers::Tags::TextField < ::ActionView::Helpers::Tags::Base include ::ActionView::Helpers::Tags::Placeholderable def render; end private def field_type; end class << self def field_type; end end end class ActionView::Helpers::Tags::TimeField < ::ActionView::Helpers::Tags::DatetimeField # @return [TimeField] a new instance of TimeField def initialize(object_name, method_name, template_object, options = T.unsafe(nil)); end private def format_date(value); end end class ActionView::Helpers::Tags::TimeSelect < ::ActionView::Helpers::Tags::DateSelect; end class ActionView::Helpers::Tags::TimeZoneSelect < ::ActionView::Helpers::Tags::Base # @return [TimeZoneSelect] a new instance of TimeZoneSelect def initialize(object_name, method_name, template_object, priority_zones, options, html_options); end def render; end end class ActionView::Helpers::Tags::Translator # @return [Translator] a new instance of Translator def initialize(object, object_name, method_and_value, scope:); end def translate; end private def human_attribute_name; end def i18n_default; end # Returns the value of attribute method_and_value. def method_and_value; end # Returns the value of attribute model. def model; end # Returns the value of attribute object_name. def object_name; end # Returns the value of attribute scope. def scope; end end class ActionView::Helpers::Tags::UrlField < ::ActionView::Helpers::Tags::TextField; end class ActionView::Helpers::Tags::WeekField < ::ActionView::Helpers::Tags::DatetimeField private def format_date(value); end end class ActionView::Helpers::Tags::WeekdaySelect < ::ActionView::Helpers::Tags::Base # @return [WeekdaySelect] a new instance of WeekdaySelect def initialize(object_name, method_name, template_object, options, html_options); end def render; end end # The TextHelper module provides a set of methods for filtering, formatting # and transforming strings, which can reduce the amount of inline Ruby code in # your views. These helper methods extend Action View making them callable # within your template files. # # ==== Sanitization # # Most text helpers that generate HTML output sanitize the given input by default, # but do not escape it. This means HTML tags will appear in the page but all malicious # code will be removed. Let's look at some examples using the +simple_format+ method: # # simple_format('Example') # # => "

    Example

    " # # simple_format('Example') # # => "

    Example

    " # # If you want to escape all content, you should invoke the +h+ method before # calling the text helper. # # simple_format h('Example') # # => "

    <a href=\"http://example.com/\">Example</a>

    " module ActionView::Helpers::TextHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper extend ::ActiveSupport::Concern include ::ActionView::Helpers::SanitizeHelper mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods # The preferred method of outputting text in your views is to use the # <%= "text" %> eRuby syntax. The regular _puts_ and _print_ methods # do not operate as expected in an eRuby code block. If you absolutely must # output text within a non-output code block (i.e., <% %>), you can use the concat method. # # <% # concat "hello" # # is the equivalent of <%= "hello" %> # # if logged_in # concat "Logged in!" # else # concat link_to('login', action: :login) # end # # will either display "Logged in!" or a login link # %> def concat(string); end # Returns the current cycle string after a cycle has been started. Useful # for complex table highlighting or any other design need which requires # the current cycle string in more than one place. # # # Alternate background colors # @items = [1,2,3,4] # <% @items.each do |item| %> #
    "> # <%= item %> #
    # <% end %> def current_cycle(name = T.unsafe(nil)); end # Creates a Cycle object whose _to_s_ method cycles through elements of an # array every time it is called. This can be used for example, to alternate # classes for table rows. You can use named cycles to allow nesting in loops. # Passing a Hash as the last parameter with a :name key will create a # named cycle. The default name for a cycle without a +:name+ key is # "default". You can manually reset a cycle by calling reset_cycle # and passing the name of the cycle. The current cycle string can be obtained # anytime using the current_cycle method. # # # Alternate CSS classes for even and odd numbers... # @items = [1,2,3,4] # # <% @items.each do |item| %> # "> # # # <% end %> #
    <%= item %>
    # # # # Cycle CSS classes for rows, and text colors for values within each row # @items = x = [{first: 'Robert', middle: 'Daniel', last: 'James'}, # {first: 'Emily', middle: 'Shannon', maiden: 'Pike', last: 'Hicks'}, # {first: 'June', middle: 'Dae', last: 'Jones'}] # <% @items.each do |item| %> # "> # # <% item.values.each do |value| %> # <%# Create a named cycle "colors" %> # "> # <%= value %> # # <% end %> # <% reset_cycle("colors") %> # # # <% end %> def cycle(first_value, *values); end # Extracts an excerpt from +text+ that matches the first instance of +phrase+. # The :radius option expands the excerpt on each side of the first occurrence of +phrase+ by the number of characters # defined in :radius (which defaults to 100). If the excerpt radius overflows the beginning or end of the +text+, # then the :omission option (which defaults to "...") will be prepended/appended accordingly. Use the # :separator option to choose the delimitation. The resulting string will be stripped in any case. If the +phrase+ # isn't found, +nil+ is returned. # # excerpt('This is an example', 'an', radius: 5) # # => ...s is an exam... # # excerpt('This is an example', 'is', radius: 5) # # => This is a... # # excerpt('This is an example', 'is') # # => This is an example # # excerpt('This next thing is an example', 'ex', radius: 2) # # => ...next... # # excerpt('This is also an example', 'an', radius: 8, omission: ' ') # # => is also an example # # excerpt('This is a very beautiful morning', 'very', separator: ' ', radius: 1) # # => ...a very beautiful... def excerpt(text, phrase, options = T.unsafe(nil)); end # Highlights one or more +phrases+ everywhere in +text+ by inserting it into # a :highlighter string. The highlighter can be specialized by passing :highlighter # as a single-quoted string with \1 where the phrase is to be inserted (defaults to # \1) or passing a block that receives each matched term. By default +text+ # is sanitized to prevent possible XSS attacks. If the input is trustworthy, passing false # for :sanitize will turn sanitizing off. # # highlight('You searched for: rails', 'rails') # # => You searched for: rails # # highlight('You searched for: rails', /for|rails/) # # => You searched for: rails # # highlight('You searched for: ruby, rails, dhh', 'actionpack') # # => You searched for: ruby, rails, dhh # # highlight('You searched for: rails', ['for', 'rails'], highlighter: '\1') # # => You searched for: rails # # highlight('You searched for: rails', 'rails', highlighter: '\1') # # => You searched for: rails # # highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match, match)) } # # => You searched for: rails # # highlight('ruby on rails', 'rails', sanitize: false) # # => ruby on rails def highlight(text, phrases, options = T.unsafe(nil), &block); end # Attempts to pluralize the +singular+ word unless +count+ is 1. If # +plural+ is supplied, it will use that when count is > 1, otherwise # it will use the Inflector to determine the plural form for the given locale, # which defaults to I18n.locale # # The word will be pluralized using rules defined for the locale # (you must define your own inflection rules for languages other than English). # See ActiveSupport::Inflector.pluralize # # pluralize(1, 'person') # # => 1 person # # pluralize(2, 'person') # # => 2 people # # pluralize(3, 'person', plural: 'users') # # => 3 users # # pluralize(0, 'person') # # => 0 people # # pluralize(2, 'Person', locale: :de) # # => 2 Personen def pluralize(count, singular, plural_arg = T.unsafe(nil), plural: T.unsafe(nil), locale: T.unsafe(nil)); end # Resets a cycle so that it starts from the first element the next time # it is called. Pass in +name+ to reset a named cycle. # # # Alternate CSS classes for even and odd numbers... # @items = [[1,2,3,4], [5,6,3], [3,4,5,6,7,4]] # # <% @items.each do |item| %> # "> # <% item.each do |value| %> # "> # <%= value %> # # <% end %> # # <% reset_cycle("colors") %> # # <% end %> #
    def reset_cycle(name = T.unsafe(nil)); end def safe_concat(string); end # Returns +text+ transformed into HTML using simple formatting rules. # Two or more consecutive newlines (\n\n or \r\n\r\n) are # considered a paragraph and wrapped in

    tags. One newline # (\n or \r\n) is considered a linebreak and a #
    tag is appended. This method does not remove the # newlines from the +text+. # # You can pass any HTML attributes into html_options. These # will be added to all created paragraphs. # # ==== Options # * :sanitize - If +false+, does not sanitize +text+. # * :wrapper_tag - String representing the wrapper tag, defaults to "p" # # ==== Examples # my_text = "Here is some basic text...\n...with a line break." # # simple_format(my_text) # # => "

    Here is some basic text...\n
    ...with a line break.

    " # # simple_format(my_text, {}, wrapper_tag: "div") # # => "
    Here is some basic text...\n
    ...with a line break.
    " # # more_text = "We want to put a paragraph...\n\n...right there." # # simple_format(more_text) # # => "

    We want to put a paragraph...

    \n\n

    ...right there.

    " # # simple_format("Look ma! A class!", class: 'description') # # => "

    Look ma! A class!

    " # # simple_format("Unblinkable.") # # => "

    Unblinkable.

    " # # simple_format("Blinkable! It's true.", {}, sanitize: false) # # => "

    Blinkable! It's true.

    " def simple_format(text, html_options = T.unsafe(nil), options = T.unsafe(nil)); end # Truncates a given +text+ after a given :length if +text+ is longer than :length # (defaults to 30). The last characters will be replaced with the :omission (defaults to "...") # for a total length not exceeding :length. # # Pass a :separator to truncate +text+ at a natural break. # # Pass a block if you want to show extra content when the text is truncated. # # The result is marked as HTML-safe, but it is escaped by default, unless :escape is # +false+. Care should be taken if +text+ contains HTML tags or entities, because truncation # may produce invalid HTML (such as unbalanced or incomplete tags). # # truncate("Once upon a time in a world far far away") # # => "Once upon a time in a world..." # # truncate("Once upon a time in a world far far away", length: 17) # # => "Once upon a ti..." # # truncate("Once upon a time in a world far far away", length: 17, separator: ' ') # # => "Once upon a..." # # truncate("And they found that many people were sleeping better.", length: 25, omission: '... (continued)') # # => "And they f... (continued)" # # truncate("

    Once upon a time in a world far far away

    ") # # => "<p>Once upon a time in a wo..." # # truncate("

    Once upon a time in a world far far away

    ", escape: false) # # => "

    Once upon a time in a wo..." # # truncate("Once upon a time in a world far far away") { link_to "Continue", "#" } # # => "Once upon a time in a wo...Continue" def truncate(text, options = T.unsafe(nil), &block); end # Wraps the +text+ into lines no longer than +line_width+ width. This method # breaks on the first whitespace character that does not exceed +line_width+ # (which is 80 by default). # # word_wrap('Once upon a time') # # => Once upon a time # # word_wrap('Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding a successor to the throne turned out to be more trouble than anyone could have imagined...') # # => Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding\na successor to the throne turned out to be more trouble than anyone could have\nimagined... # # word_wrap('Once upon a time', line_width: 8) # # => Once\nupon a\ntime # # word_wrap('Once upon a time', line_width: 1) # # => Once\nupon\na\ntime # # You can also specify a custom +break_sequence+ ("\n" by default) # # word_wrap('Once upon a time', line_width: 1, break_sequence: "\r\n") # # => Once\r\nupon\r\na\r\ntime def word_wrap(text, line_width: T.unsafe(nil), break_sequence: T.unsafe(nil)); end private def cut_excerpt_part(part_position, part, separator, options); end # The cycle helpers need to store the cycles in a place that is # guaranteed to be reset every time a page is rendered, so it # uses an instance variable of ActionView::Base. def get_cycle(name); end def set_cycle(name, cycle_object); end def split_paragraphs(text); end end class ActionView::Helpers::TextHelper::Cycle # @return [Cycle] a new instance of Cycle def initialize(first_value, *values); end def current_value; end def reset; end def to_s; end # Returns the value of attribute values. def values; end private def next_index; end def previous_index; end def step_index(n); end end module ActionView::Helpers::TranslationHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper extend ::ActiveSupport::Concern # Delegates to I18n.localize with no additional functionality. # # See https://www.rubydoc.info/gems/i18n/I18n/Backend/Base:localize # for more information. def l(object, **options); end # Delegates to I18n.localize with no additional functionality. # # See https://www.rubydoc.info/gems/i18n/I18n/Backend/Base:localize # for more information. def localize(object, **options); end # Delegates to I18n#translate but also performs three additional # functions. # # First, it will ensure that any thrown +MissingTranslation+ messages will # be rendered as inline spans that: # # * Have a translation-missing class applied # * Contain the missing key as the value of the +title+ attribute # * Have a titleized version of the last key segment as text # # For example, the value returned for the missing translation key # "blog.post.title" will be: # # Title # # This allows for views to display rather reasonable strings while still # giving developers a way to find missing translations. # # If you would prefer missing translations to raise an error, you can # opt out of span-wrapping behavior globally by setting # config.i18n.raise_on_missing_translations = true or # individually by passing raise: true as an option to # translate. # # Second, if the key starts with a period translate will scope # the key by the current partial. Calling translate(".foo") from # the people/index.html.erb template is equivalent to calling # translate("people.index.foo"). This makes it less # repetitive to translate many keys within the same partial and provides # a convention to scope keys consistently. # # Third, the translation will be marked as html_safe if the key # has the suffix "_html" or the last element of the key is "html". Calling # translate("footer_html") or translate("footer.html") # will return an HTML safe string that won't be escaped by other HTML # helper methods. This naming convention helps to identify translations # that include HTML tags so that you know what kind of output to expect # when you call translate in a template and translators know which keys # they can provide HTML values for. # # To access the translated text along with the fully resolved # translation key, translate accepts a block: # # <%= translate(".relative_key") do |translation, resolved_key| %> # <%= translation %> # <% end %> # # This enables annotate translated text to be aware of the scope it was # resolved against. def t(key, **options); end # Delegates to I18n#translate but also performs three additional # functions. # # First, it will ensure that any thrown +MissingTranslation+ messages will # be rendered as inline spans that: # # * Have a translation-missing class applied # * Contain the missing key as the value of the +title+ attribute # * Have a titleized version of the last key segment as text # # For example, the value returned for the missing translation key # "blog.post.title" will be: # # Title # # This allows for views to display rather reasonable strings while still # giving developers a way to find missing translations. # # If you would prefer missing translations to raise an error, you can # opt out of span-wrapping behavior globally by setting # config.i18n.raise_on_missing_translations = true or # individually by passing raise: true as an option to # translate. # # Second, if the key starts with a period translate will scope # the key by the current partial. Calling translate(".foo") from # the people/index.html.erb template is equivalent to calling # translate("people.index.foo"). This makes it less # repetitive to translate many keys within the same partial and provides # a convention to scope keys consistently. # # Third, the translation will be marked as html_safe if the key # has the suffix "_html" or the last element of the key is "html". Calling # translate("footer_html") or translate("footer.html") # will return an HTML safe string that won't be escaped by other HTML # helper methods. This naming convention helps to identify translations # that include HTML tags so that you know what kind of output to expect # when you call translate in a template and translators know which keys # they can provide HTML values for. # # To access the translated text along with the fully resolved # translation key, translate accepts a block: # # <%= translate(".relative_key") do |translation, resolved_key| %> # <%= translation %> # <% end %> # # This enables annotate translated text to be aware of the scope it was # resolved against. def translate(key, **options); end private def missing_translation(key, options); end def scope_key_by_partial(key); end class << self def raise_on_missing_translations; end def raise_on_missing_translations=(_arg0); end end end ActionView::Helpers::TranslationHelper::MISSING_TRANSLATION = T.let(T.unsafe(nil), Integer) ActionView::Helpers::TranslationHelper::NO_DEFAULT = T.let(T.unsafe(nil), Array) # Provides a set of methods for making links and getting URLs that # depend on the routing subsystem (see ActionDispatch::Routing). # This allows you to use the same format for links in views # and controllers. module ActionView::Helpers::UrlHelper include ::ActionView::Helpers::CaptureHelper include ::ActionView::Helpers::OutputSafetyHelper include ::ActionView::Helpers::TagHelper extend ::ActiveSupport::Concern mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods # Generates a form containing a single button that submits to the URL created # by the set of +options+. This is the safest method to ensure links that # cause changes to your data are not triggered by search bots or accelerators. # If the HTML button does not work with your layout, you can also consider # using the +link_to+ method with the :method modifier as described in # the +link_to+ documentation. # # You can control the form and button behavior with +html_options+. Most # values in +html_options+ are passed through to the button element. For # example, passing a +:class+ option within +html_options+ will set the # class attribute of the button element. # # The class attribute of the form element can be set by passing a # +:form_class+ option within +html_options+. It defaults to # "button_to" to allow styling of the form and its children. # # The form submits a POST request by default. You can specify a different # HTTP verb via the +:method+ option within +html_options+. # # ==== Options # The +options+ hash accepts the same options as +url_for+. To generate a #

    element without an [action] attribute, pass # false: # # <%= button_to "New", false %> # # => " # # # # # #
    " # # Most values in +html_options+ are passed through to the button element, # but there are a few special options: # # * :method - \Symbol of HTTP verb. Supported verbs are :post, :get, # :delete, :patch, and :put. By default it will be :post. # * :disabled - If set to true, it will generate a disabled button. # * :data - This option can be used to add custom data attributes. # * :form - This hash will be form attributes # * :form_class - This controls the class of the form within which the submit button will # be placed # * :params - \Hash of parameters to be rendered as hidden fields within the form. # # ==== Examples # <%= button_to "New", action: "new" %> # # => "
    # # # # # #
    " # # <%= button_to "New", new_article_path %> # # => "
    # # # # # #
    " # # <%= button_to "New", new_article_path, params: { time: Time.now } %> # # => "
    # # # # # # # #
    " # # <%= button_to [:make_happy, @user] do %> # Make happy <%= @user.name %> # <% end %> # # => "
    # # # # # #
    " # # <%= button_to "New", { action: "new" }, form_class: "new-thing" %> # # => "
    # # # # # #
    " # # <%= button_to "Create", { action: "create" }, form: { "data-type" => "json" } %> # # => "
    # # # # # #
    " # # ==== Deprecated: Rails UJS Attributes # # Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7, # this library is no longer on by default. This library integrated with the following options: # # * :remote - If set to true, will allow @rails/ujs to control the # submit behavior. By default this behavior is an Ajax submit. # # @rails/ujs also integrated with the following +:data+ options: # # * confirm: "question?" - This will allow @rails/ujs # to prompt with the question specified (in this case, the # resulting text would be question?). If the user accepts, the # button is processed normally, otherwise no action is taken. # * :disable_with - Value of this parameter will be # used as the value for a disabled version of the submit # button when the form is submitted. # # ===== Rails UJS Examples # # <%= button_to "Create", { action: "create" }, remote: true, form: { "data-type" => "json" } %> # # => "
    # # # # # #
    " def button_to(name = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end def button_to_generates_button_tag; end def button_to_generates_button_tag=(val); end # @return [Boolean] def current_page?(*args); end # Creates an anchor element of the given +name+ using a URL created by the set of +options+. # See the valid options in the documentation for +url_for+. It's also possible to # pass a \String instead of an options hash, which generates an anchor element that uses the # value of the \String as the href for the link. Using a :back \Symbol instead # of an options hash will generate a link to the referrer (a JavaScript back link # will be used in place of a referrer if none exists). If +nil+ is passed as the name # the value of the link itself will become the name. # # ==== Signatures # # link_to(body, url, html_options = {}) # # url is a String; you can use URL helpers like # # posts_path # # link_to(body, url_options = {}, html_options = {}) # # url_options, except :method, is passed to url_for # # link_to(options = {}, html_options = {}) do # # name # end # # link_to(url, html_options = {}) do # # name # end # # link_to(active_record_model) # # ==== Options # * :data - This option can be used to add custom data attributes. # # ==== Examples # # Because it relies on +url_for+, +link_to+ supports both older-style controller/action/id arguments # and newer RESTful routes. Current Rails style favors RESTful routes whenever possible, so base # your application on resources and use # # link_to "Profile", profile_path(@profile) # # => Profile # # or the even pithier # # link_to "Profile", @profile # # => Profile # # in place of the older more verbose, non-resource-oriented # # link_to "Profile", controller: "profiles", action: "show", id: @profile # # => Profile # # Similarly, # # link_to "Profiles", profiles_path # # => Profiles # # is better than # # link_to "Profiles", controller: "profiles" # # => Profiles # # When name is +nil+ the href is presented instead # # link_to nil, "http://example.com" # # => http://www.example.com # # More concise yet, when +name+ is an Active Record model that defines a # +to_s+ method returning a default value or a model instance attribute # # link_to @profile # # => Eileen # # You can use a block as well if your link target is hard to fit into the name parameter. ERB example: # # <%= link_to(@profile) do %> # <%= @profile.name %> -- Check it out! # <% end %> # # => # David -- Check it out! # # # Classes and ids for CSS are easy to produce: # # link_to "Articles", articles_path, id: "news", class: "article" # # => Articles # # Be careful when using the older argument style, as an extra literal hash is needed: # # link_to "Articles", { controller: "articles" }, id: "news", class: "article" # # => Articles # # Leaving the hash off gives the wrong link: # # link_to "WRONG!", controller: "articles", id: "news", class: "article" # # => WRONG! # # +link_to+ can also produce links with anchors or query strings: # # link_to "Comment wall", profile_path(@profile, anchor: "wall") # # => Comment wall # # link_to "Ruby on Rails search", controller: "searches", query: "ruby on rails" # # => Ruby on Rails search # # link_to "Nonsense search", searches_path(foo: "bar", baz: "quux") # # => Nonsense search # # You can set any link attributes such as target, rel, type: # # link_to "External link", "http://www.rubyonrails.org/", target: "_blank", rel: "nofollow" # # => External link # # ==== Deprecated: Rails UJS Attributes # # Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7, # this library is no longer on by default. This library integrated with the following options: # # * method: symbol of HTTP verb - This modifier will dynamically # create an HTML form and immediately submit the form for processing using # the HTTP verb specified. Useful for having links perform a POST operation # in dangerous actions like deleting a record (which search bots can follow # while spidering your site). Supported verbs are :post, :delete, :patch, and :put. # Note that if the user has JavaScript disabled, the request will fall back # to using GET. If href: '#' is used and the user has JavaScript # disabled clicking the link will have no effect. If you are relying on the # POST behavior, you should check for it in your controller's action by using # the request object's methods for post?, delete?, patch?, or put?. # * remote: true - This will allow @rails/ujs # to make an Ajax request to the URL in question instead of following # the link. # # @rails/ujs also integrated with the following +:data+ options: # # * confirm: "question?" - This will allow @rails/ujs # to prompt with the question specified (in this case, the # resulting text would be question?). If the user accepts, the # link is processed normally, otherwise no action is taken. # * :disable_with - Value of this parameter will be used as the # name for a disabled version of the link. # # ===== Rails UJS Examples # # link_to "Remove Profile", profile_path(@profile), method: :delete # # => Remove Profile # # link_to "Visit Other Site", "http://www.rubyonrails.org/", data: { confirm: "Are you sure?" } # # => Visit Other Site def link_to(name = T.unsafe(nil), options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates a link tag of the given +name+ using a URL created by the set of # +options+ if +condition+ is true, otherwise only the name is # returned. To specialize the default behavior, you can pass a block that # accepts the name or the full argument list for +link_to_if+. # # ==== Examples # <%= link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) %> # # If the user isn't logged in... # # => Login # # <%= # link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) do # link_to(@current_user.login, { controller: "accounts", action: "show", id: @current_user }) # end # %> # # If the user isn't logged in... # # => Login # # If they are logged in... # # => my_username def link_to_if(condition, name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates a link tag of the given +name+ using a URL created by the set of # +options+ unless +condition+ is true, in which case only the name is # returned. To specialize the default behavior (i.e., show a login link rather # than just the plaintext link text), you can pass a block that # accepts the name or the full argument list for +link_to_unless+. # # ==== Examples # <%= link_to_unless(@current_user.nil?, "Reply", { action: "reply" }) %> # # If the user is logged in... # # => Reply # # <%= # link_to_unless(@current_user.nil?, "Reply", { action: "reply" }) do |name| # link_to(name, { controller: "accounts", action: "signup" }) # end # %> # # If the user is logged in... # # => Reply # # If not... # # => Reply def link_to_unless(condition, name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates a link tag of the given +name+ using a URL created by the set of # +options+ unless the current request URI is the same as the links, in # which case only the name is returned (or the given block is yielded, if # one exists). You can give +link_to_unless_current+ a block which will # specialize the default behavior (e.g., show a "Start Here" link rather # than the link's text). # # ==== Examples # Let's say you have a navigation menu... # # # # If in the "about" action, it will render... # # # # ...but if in the "index" action, it will render: # # # # The implicit block given to +link_to_unless_current+ is evaluated if the current # action is the action given. So, if we had a comments page and wanted to render a # "Go Back" link instead of a link to the comments page, we could do something like this... # # <%= # link_to_unless_current("Comment", { controller: "comments", action: "new" }) do # link_to("Go back", { controller: "posts", action: "index" }) # end # %> def link_to_unless_current(name, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates a mailto link tag to the specified +email_address+, which is # also used as the name of the link unless +name+ is specified. Additional # HTML attributes for the link can be passed in +html_options+. # # +mail_to+ has several methods for customizing the email itself by # passing special keys to +html_options+. # # ==== Options # * :subject - Preset the subject line of the email. # * :body - Preset the body of the email. # * :cc - Carbon Copy additional recipients on the email. # * :bcc - Blind Carbon Copy additional recipients on the email. # * :reply_to - Preset the Reply-To field of the email. # # ==== Obfuscation # Prior to Rails 4.0, +mail_to+ provided options for encoding the address # in order to hinder email harvesters. To take advantage of these options, # install the +actionview-encoded_mail_to+ gem. # # ==== Examples # mail_to "me@domain.com" # # => me@domain.com # # mail_to "me@domain.com", "My email" # # => My email # # mail_to "me@domain.com", cc: "ccaddress@domain.com", # subject: "This is an example email" # # => me@domain.com # # You can use a block as well if your link target is hard to fit into the name parameter. ERB example: # # <%= mail_to "me@domain.com" do %> # Email me: me@domain.com # <% end %> # # => # Email me: me@domain.com # def mail_to(email_address, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates a TEL anchor link tag to the specified +phone_number+. When the # link is clicked, the default app to make phone calls is opened and # prepopulated with the phone number. # # If +name+ is not specified, +phone_number+ will be used as the name of # the link. # # A +country_code+ option is supported, which prepends a plus sign and the # given country code to the linked phone number. For example, # country_code: "01" will prepend +01 to the linked # phone number. # # Additional HTML attributes for the link can be passed via +html_options+. # # ==== Options # * :country_code - Prepends the country code to the phone number # # ==== Examples # phone_to "1234567890" # # => 1234567890 # # phone_to "1234567890", "Phone me" # # => Phone me # # phone_to "1234567890", country_code: "01" # # => 1234567890 # # You can use a block as well if your link target is hard to fit into the name parameter. \ERB example: # # <%= phone_to "1234567890" do %> # Phone me: # <% end %> # # => # Phone me: # def phone_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Creates an SMS anchor link tag to the specified +phone_number+. When the # link is clicked, the default SMS messaging app is opened ready to send a # message to the linked phone number. If the +body+ option is specified, # the contents of the message will be preset to +body+. # # If +name+ is not specified, +phone_number+ will be used as the name of # the link. # # A +country_code+ option is supported, which prepends a plus sign and the # given country code to the linked phone number. For example, # country_code: "01" will prepend +01 to the linked # phone number. # # Additional HTML attributes for the link can be passed via +html_options+. # # ==== Options # * :country_code - Prepend the country code to the phone number. # * :body - Preset the body of the message. # # ==== Examples # sms_to "5155555785" # # => 5155555785 # # sms_to "5155555785", country_code: "01" # # => 5155555785 # # sms_to "5155555785", "Text me" # # => Text me # # sms_to "5155555785", body: "I have a question about your product." # # => 5155555785 # # You can use a block as well if your link target is hard to fit into the name parameter. \ERB example: # # <%= sms_to "5155555785" do %> # Text me: # <% end %> # # => # Text me: # def sms_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end # Basic implementation of url_for to allow use helpers without routes existence def url_for(options = T.unsafe(nil)); end private def _back_url; end def _filtered_referrer; end def add_method_to_attributes!(html_options, method); end def convert_options_to_data_attributes(options, html_options); end # @return [Boolean] def link_to_remote_options?(options); end def method_for_options(options); end # @return [Boolean] def method_not_get_method?(method); end def method_tag(method); end def remove_trailing_slash!(url_string); end # Returns an array of hashes each containing :name and :value keys # suitable for use as the names and values of form input fields: # # to_form_params(name: 'David', nationality: 'Danish') # # => [{name: 'name', value: 'David'}, {name: 'nationality', value: 'Danish'}] # # to_form_params(country: { name: 'Denmark' }) # # => [{name: 'country[name]', value: 'Denmark'}] # # to_form_params(countries: ['Denmark', 'Sweden']}) # # => [{name: 'countries[]', value: 'Denmark'}, {name: 'countries[]', value: 'Sweden'}] # # An optional namespace can be passed to enclose key names: # # to_form_params({ name: 'Denmark' }, 'country') # # => [{name: 'country[name]', value: 'Denmark'}] def to_form_params(attribute, namespace = T.unsafe(nil)); end def token_tag(token = T.unsafe(nil), form_options: T.unsafe(nil)); end def url_target(name, options); end class << self def button_to_generates_button_tag; end def button_to_generates_button_tag=(val); end end end # This helper may be included in any class that includes the # URL helpers of a routes (routes.url_helpers). Some methods # provided here will only work in the context of a request # (link_to_unless_current, for instance), which must be provided # as a method called #request on the context. ActionView::Helpers::UrlHelper::BUTTON_TAG_METHOD_VERBS = T.let(T.unsafe(nil), Array) module ActionView::Helpers::UrlHelper::ClassMethods def _url_for_modules; end end ActionView::Helpers::UrlHelper::STRINGIFIED_COMMON_METHODS = T.let(T.unsafe(nil), Hash) # This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, # it will trigger the lookup_context and consequently expire the cache. class ActionView::I18nProxy < ::I18n::Config # @return [I18nProxy] a new instance of I18nProxy def initialize(original_config, lookup_context); end def locale; end def locale=(value); end def lookup_context; end def original_config; end end # Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in # repeated setups. The inclusion pattern has pages that look like this: # # <%= render "shared/header" %> # Hello World # <%= render "shared/footer" %> # # This approach is a decent way of keeping common structures isolated from the changing content, but it's verbose # and if you ever want to change the structure of these two includes, you'll have to change all the templates. # # With layouts, you can flip it around and have the common structure know where to insert changing content. This means # that the header and footer are only mentioned in one place, like this: # # // The header part of this layout # <%= yield %> # // The footer part of this layout # # And then you have content pages that look like this: # # hello world # # At rendering time, the content page is computed and then inserted in the layout, like this: # # // The header part of this layout # hello world # // The footer part of this layout # # == Accessing shared variables # # Layouts have access to variables specified in the content pages and vice versa. This allows you to have layouts with # references that won't materialize before rendering time: # #

    <%= @page_title %>

    # <%= yield %> # # ...and content pages that fulfill these references _at_ rendering time: # # <% @page_title = "Welcome" %> # Off-world colonies offers you a chance to start a new life # # The result after rendering is: # #

    Welcome

    # Off-world colonies offers you a chance to start a new life # # == Layout assignment # # You can either specify a layout declaratively (using the #layout class method) or give # it the same name as your controller, and place it in app/views/layouts. # If a subclass does not have a layout specified, it inherits its layout using normal Ruby inheritance. # # For instance, if you have PostsController and a template named app/views/layouts/posts.html.erb, # that template will be used for all actions in PostsController and controllers inheriting # from PostsController. # # If you use a module, for instance Weblog::PostsController, you will need a template named # app/views/layouts/weblog/posts.html.erb. # # Since all your controllers inherit from ApplicationController, they will use # app/views/layouts/application.html.erb if no other layout is specified # or provided. # # == Inheritance Examples # # class BankController < ActionController::Base # # bank.html.erb exists # # class ExchangeController < BankController # # exchange.html.erb exists # # class CurrencyController < BankController # # class InformationController < BankController # layout "information" # # class TellerController < InformationController # # teller.html.erb exists # # class EmployeeController < InformationController # # employee.html.erb exists # layout nil # # class VaultController < BankController # layout :access_level_layout # # class TillController < BankController # layout false # # In these examples, we have three implicit lookup scenarios: # * The +BankController+ uses the "bank" layout. # * The +ExchangeController+ uses the "exchange" layout. # * The +CurrencyController+ inherits the layout from BankController. # # However, when a layout is explicitly set, the explicitly set layout wins: # * The +InformationController+ uses the "information" layout, explicitly set. # * The +TellerController+ also uses the "information" layout, because the parent explicitly set it. # * The +EmployeeController+ uses the "employee" layout, because it set the layout to +nil+, resetting the parent configuration. # * The +VaultController+ chooses a layout dynamically by calling the access_level_layout method. # * The +TillController+ does not use a layout at all. # # == Types of layouts # # Layouts are basically just regular templates, but the name of this template needs not be specified statically. Sometimes # you want to alternate layouts depending on runtime information, such as whether someone is logged in or not. This can # be done either by specifying a method reference as a symbol or using an inline method (as a proc). # # The method reference is the preferred approach to variable layouts and is used like this: # # class WeblogController < ActionController::Base # layout :writers_and_readers # # def index # # fetching posts # end # # private # def writers_and_readers # logged_in? ? "writer_layout" : "reader_layout" # end # end # # Now when a new request for the index action is processed, the layout will vary depending on whether the person accessing # is logged in or not. # # If you want to use an inline method, such as a proc, do something like this: # # class WeblogController < ActionController::Base # layout proc { |controller| controller.logged_in? ? "writer_layout" : "reader_layout" } # end # # If an argument isn't given to the proc, it's evaluated in the context of # the current controller anyway. # # class WeblogController < ActionController::Base # layout proc { logged_in? ? "writer_layout" : "reader_layout" } # end # # Of course, the most common way of specifying a layout is still just as a plain template name: # # class WeblogController < ActionController::Base # layout "weblog_standard" # end # # The template will be looked always in app/views/layouts/ folder. But you can point # layouts folder direct also. layout "layouts/demo" is the same as layout "demo". # # Setting the layout to +nil+ forces it to be looked up in the filesystem and fallbacks to the parent behavior if none exists. # Setting it to +nil+ is useful to re-enable template lookup overriding a previous configuration set in the parent: # # class ApplicationController < ActionController::Base # layout "application" # end # # class PostsController < ApplicationController # # Will use "application" layout # end # # class CommentsController < ApplicationController # # Will search for "comments" layout and fallback "application" layout # layout nil # end # # == Conditional layouts # # If you have a layout that by default is applied to all the actions of a controller, you still have the option of rendering # a given action or set of actions without a layout, or restricting a layout to only a single action or a set of actions. The # :only and :except options can be passed to the layout call. For example: # # class WeblogController < ActionController::Base # layout "weblog_standard", except: :rss # # # ... # # end # # This will assign "weblog_standard" as the WeblogController's layout for all actions except for the +rss+ action, which will # be rendered directly, without wrapping a layout around the rendered view. # # Both the :only and :except condition can accept an arbitrary number of method references, so # except: [ :rss, :text_only ] is valid, as is except: :rss. # # == Using a different layout in the action render call # # If most of your actions use the same layout, it makes perfect sense to define a controller-wide layout as described above. # Sometimes you'll have exceptions where one action wants to use a different layout than the rest of the controller. # You can do this by passing a :layout option to the render call. For example: # # class WeblogController < ActionController::Base # layout "weblog_standard" # # def help # render action: "help", layout: "help" # end # end # # This will override the controller-wide "weblog_standard" layout, and will render the help action with the "help" layout instead. module ActionView::Layouts extend ::ActiveSupport::Concern include GeneratedInstanceMethods include ::ActionView::ViewPaths include ::ActionView::Rendering mixes_in_class_methods GeneratedClassMethods mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods mixes_in_class_methods ::ActionView::Rendering::ClassMethods mixes_in_class_methods ::ActionView::Layouts::ClassMethods def initialize(*_arg0); end def _layout_conditions(*_arg0, &_arg1); end def _normalize_options(options); end def action_has_layout=(_arg0); end # Controls whether an action should be rendered using a layout. # If you want to disable any layout settings for the # current action so that it is rendered without a layout then # either override this method in your controller to return false # for that action or set the action_has_layout attribute # to false before rendering. # # @return [Boolean] def action_has_layout?; end private # @return [Boolean] def _conditional_layout?; end # Returns the default layout for this controller. # Optionally raises an exception if the layout could not be found. # # ==== Parameters # * formats - The formats accepted to this layout # * require_layout - If set to +true+ and layout is not found, # an +ArgumentError+ exception is raised (defaults to +false+) # # ==== Returns # * template - The template object for the default layout (or +nil+) def _default_layout(lookup_context, formats, require_layout = T.unsafe(nil)); end # @return [Boolean] def _include_layout?(options); end # This will be overwritten by _write_layout_method def _layout(*_arg0); end # Determine the layout for a given name, taking into account the name type. # # ==== Parameters # * name - The name of the template def _layout_for_option(name); end def _normalize_layout(value); end module GeneratedClassMethods def _layout; end def _layout=(value); end def _layout?; end def _layout_conditions; end def _layout_conditions=(value); end def _layout_conditions?; end end module GeneratedInstanceMethods; end end module ActionView::Layouts::ClassMethods # Creates a _layout method to be called by _default_layout . # # If a layout is not explicitly mentioned then look for a layout with the controller's name. # if nothing is found then try same procedure to find super class's layout. def _write_layout_method; end def inherited(klass); end # Specify the layout to use for this class. # # If the specified layout is a: # String:: the String is the template name # Symbol:: call the method specified by the symbol # Proc:: call the passed Proc # false:: There is no layout # true:: raise an ArgumentError # nil:: Force default layout behavior with inheritance # # Return value of +Proc+ and +Symbol+ arguments should be +String+, +false+, +true+, or +nil+ # with the same meaning as described above. # # ==== Parameters # # * layout - The layout to use. # # ==== Options (conditions) # # * +:only+ - A list of actions to apply this layout to. # * +:except+ - Apply this layout to all actions but this one. def layout(layout, conditions = T.unsafe(nil)); end private # If no layout is supplied, look for a template named the return # value of this method. # # ==== Returns # * String - A template name def _implied_layout_name; end end # This module is mixed in if layout conditions are provided. This means # that if no layout conditions are used, this method is not used module ActionView::Layouts::ClassMethods::LayoutConditions private # Determines whether the current action has a layout definition by # checking the action name against the :only and :except conditions # set by the layout method. # # ==== Returns # * Boolean - True if the action has a layout definition, false otherwise. # # @return [Boolean] def _conditional_layout?; end end # = Action View Log Subscriber # # Provides functionality so that Rails can output logs from Action View. class ActionView::LogSubscriber < ::ActiveSupport::LogSubscriber # @return [LogSubscriber] a new instance of LogSubscriber def initialize; end def logger; end def render_collection(event); end def render_layout(event); end def render_partial(event); end def render_template(event); end def start(name, id, payload); end private def cache_message(payload); end def from_rails_root(string); end def log_rendering_start(payload, name); end def rails_root; end def render_count(payload); end end ActionView::LogSubscriber::EMPTY = T.let(T.unsafe(nil), String) ActionView::LogSubscriber::VIEWS_PATTERN = T.let(T.unsafe(nil), Regexp) # = Action View Lookup Context # # LookupContext is the object responsible for holding all information # required for looking up templates, i.e. view paths and details. # LookupContext is also responsible for generating a key, given to # view paths, used in the resolver cache lookup. Since this key is generated # only once during the request, it speeds up all cache accesses. class ActionView::LookupContext include ::ActionView::LookupContext::Accessors include ::ActionView::LookupContext::DetailsCache include ::ActionView::LookupContext::ViewPaths # @return [LookupContext] a new instance of LookupContext def initialize(view_paths, details = T.unsafe(nil), prefixes = T.unsafe(nil)); end def digest_cache; end # Override formats= to expand ["*/*"] values and automatically # add :html as fallback to :js. def formats=(values); end # Override locale to return a symbol instead of array. def locale; end # Overload locale= to also set the I18n.locale. If the current I18n.config object responds # to original_config, it means that it has a copy of the original I18n configuration and it's # acting as proxy, which we need to skip. def locale=(value); end def prefixes; end def prefixes=(_arg0); end def rendered_format; end def rendered_format=(_arg0); end def with_prepended_formats(formats); end private def initialize_details(target, details); end class << self def register_detail(name, &block); end def registered_details; end def registered_details=(_arg0); end end end # Holds accessors for the registered details. module ActionView::LookupContext::Accessors def default_formats; end def default_handlers; end def default_locale; end def default_variants; end def formats; end def formats=(value); end def handlers; end def handlers=(value); end def locale; end def locale=(value); end def variants; end def variants=(value); end end ActionView::LookupContext::Accessors::DEFAULT_PROCS = T.let(T.unsafe(nil), Hash) # Add caching behavior on top of Details. module ActionView::LookupContext::DetailsCache # Returns the value of attribute cache. def cache; end # Sets the attribute cache # # @param value the value to set the attribute cache to. def cache=(_arg0); end # Calculate the details key. Remove the handlers from calculation to improve performance # since the user cannot modify it explicitly. def details_key; end # Temporary skip passing the details_key forward. def disable_cache; end private def _set_detail(key, value); end end class ActionView::LookupContext::DetailsKey def eql?(_arg0); end class << self def clear; end def details_cache_key(details); end def digest_cache(details); end def digest_caches; end def view_context_class(klass); end end end # Helpers related to template lookup using the lookup context information. module ActionView::LookupContext::ViewPaths # @return [Boolean] def any?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil)); end # @return [Boolean] def any_templates?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil)); end # @return [Boolean] def exists?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), **options); end def find(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end def find_all(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end def find_template(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), options = T.unsafe(nil)); end # Returns the value of attribute html_fallback_for_js. def html_fallback_for_js; end # @return [Boolean] def template_exists?(name, prefixes = T.unsafe(nil), partial = T.unsafe(nil), keys = T.unsafe(nil), **options); end # Returns the value of attribute view_paths. def view_paths; end private # Whenever setting view paths, makes a copy so that we can manipulate them in # instance objects as we wish. def build_view_paths(paths); end # Compute details hash and key according to user options (e.g. passed from #render). def detail_args_for(options); end def detail_args_for_any; end # Fix when prefix is specified as part of the template name def normalize_name(name, prefixes); end end class ActionView::MissingTemplate < ::ActionView::ActionViewError include ::DidYouMean::Correctable # @return [MissingTemplate] a new instance of MissingTemplate def initialize(paths, path, prefixes, partial, details, *_arg5); end # Apps may have thousands of candidate templates so we attempt to # generate the suggestions as efficiently as possible. # First we split templates into prefixes and basenames, so that those can # be matched separately. def corrections; end # Returns the value of attribute partial. def partial; end # Returns the value of attribute path. def path; end # Returns the value of attribute paths. def paths; end # Returns the value of attribute prefixes. def prefixes; end end class ActionView::MissingTemplate::Results # @return [Results] a new instance of Results def initialize(size); end def add(path, score); end # @return [Boolean] def should_record?(score); end def to_a; end end class ActionView::MissingTemplate::Results::Result < ::Struct # Returns the value of attribute path # # @return [Object] the current value of path def path; end # Sets the attribute path # # @param value [Object] the value to set the attribute path to. # @return [Object] the newly set value def path=(_); end # Returns the value of attribute score # # @return [Object] the current value of score def score; end # Sets the attribute score # # @param value [Object] the value to set the attribute score to. # @return [Object] the newly set value def score=(_); end class << self def [](*_arg0); end def inspect; end def members; end def new(*_arg0); end end end module ActionView::ModelNaming # Converts the given object to an Active Model compliant one. def convert_to_model(object); end def model_name_from_record_or_class(record_or_class); end end class ActionView::ObjectRenderer < ::ActionView::PartialRenderer include ::ActionView::AbstractRenderer::ObjectRendering # @return [ObjectRenderer] a new instance of ObjectRenderer def initialize(lookup_context, options); end def render_object_derive_partial(object, context, block); end def render_object_with_partial(object, partial, context, block); end private def render_partial_template(view, locals, template, layout, block); end def template_keys(path); end end # 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" class ActionView::OutputBuffer < ::ActiveSupport::SafeBuffer # @return [OutputBuffer] a new instance of OutputBuffer def initialize(*_arg0); end def <<(value); end def append=(value); end def safe_append=(value); end def safe_expr_append=(val); end end class ActionView::OutputFlow # @return [OutputFlow] a new instance of OutputFlow def initialize; end # Called by content_for def append(key, value); end # Called by content_for def append!(key, value); end # Returns the value of attribute content. def content; end # Called by _layout_for to read stored values. def get(key); end # Called by each renderer object to set the layout contents. def set(key, value); end end class ActionView::PartialIteration # @return [PartialIteration] a new instance of PartialIteration def initialize(size); end # Check if this is the first iteration of the partial. # # @return [Boolean] def first?; end # The current iteration of the partial. def index; end def iterate!; end # Check if this is the last iteration of the partial. # # @return [Boolean] def last?; end # The number of iterations that will be done by the partial. def size; end end # = Action View Partials # # There's also a convenience method for rendering sub templates within the current controller that depends on a # single object (we call this kind of sub templates for partials). It relies on the fact that partials should # follow the naming convention of being prefixed with an underscore -- as to separate them from regular # templates that could be rendered on their own. # # In a template for Advertiser#account: # # <%= render partial: "account" %> # # This would render "advertiser/_account.html.erb". # # In another template for Advertiser#buy, we could have: # # <%= render partial: "account", locals: { account: @buyer } %> # # <% @advertisements.each do |ad| %> # <%= render partial: "ad", locals: { ad: ad } %> # <% end %> # # This would first render advertiser/_account.html.erb with @buyer passed in as the local variable +account+, then # render advertiser/_ad.html.erb and pass the local variable +ad+ to the template for display. # # == The +:as+ and +:object+ options # # By default ActionView::PartialRenderer doesn't have any local variables. # The :object option can be used to pass an object to the partial. For instance: # # <%= render partial: "account", object: @buyer %> # # would provide the @buyer object to the partial, available under the local variable +account+ and is # equivalent to: # # <%= render partial: "account", locals: { account: @buyer } %> # # With the :as option we can specify a different name for said local variable. For example, if we # wanted it to be +user+ instead of +account+ we'd do: # # <%= render partial: "account", object: @buyer, as: 'user' %> # # This is equivalent to # # <%= render partial: "account", locals: { user: @buyer } %> # # == \Rendering a collection of partials # # The example of partial use describes a familiar pattern where a template needs to iterate over an array and # render a sub template for each of the elements. This pattern has been implemented as a single method that # accepts an array and renders a partial by the same name as the elements contained within. So the three-lined # example in "Using partials" can be rewritten with a single line: # # <%= render partial: "ad", collection: @advertisements %> # # This will render advertiser/_ad.html.erb and pass the local variable +ad+ to the template for display. An # iteration object will automatically be made available to the template with a name of the form # +partial_name_iteration+. The iteration object has knowledge about which index the current object has in # the collection and the total size of the collection. The iteration object also has two convenience methods, # +first?+ and +last?+. In the case of the example above, the template would be fed +ad_iteration+. # For backwards compatibility the +partial_name_counter+ is still present and is mapped to the iteration's # +index+ method. # # The :as option may be used when rendering partials. # # You can specify a partial to be rendered between elements via the :spacer_template option. # The following example will render advertiser/_ad_divider.html.erb between each ad partial: # # <%= render partial: "ad", collection: @advertisements, spacer_template: "ad_divider" %> # # If the given :collection is +nil+ or empty, render will return +nil+. This will allow you # to specify a text which will be displayed instead by using this form: # # <%= render(partial: "ad", collection: @advertisements) || "There's no ad to be displayed" %> # # == \Rendering shared partials # # Two controllers can share a set of partials and render them like this: # # <%= render partial: "advertisement/ad", locals: { ad: @advertisement } %> # # This will render the partial advertisement/_ad.html.erb regardless of which controller this is being called from. # # == \Rendering objects that respond to +to_partial_path+ # # Instead of explicitly naming the location of a partial, you can also let PartialRenderer do the work # and pick the proper path by checking +to_partial_path+ method. # # # @account.to_partial_path returns 'accounts/account', so it can be used to replace: # # <%= render partial: "accounts/account", locals: { account: @account} %> # <%= render partial: @account %> # # # @posts is an array of Post instances, so every post record returns 'posts/post' on +to_partial_path+, # # that's why we can replace: # # <%= render partial: "posts/post", collection: @posts %> # <%= render partial: @posts %> # # == \Rendering the default case # # If you're not going to be using any of the options like collections or layouts, you can also use the short-hand # defaults of render to render partials. Examples: # # # Instead of <%= render partial: "account" %> # <%= render "account" %> # # # Instead of <%= render partial: "account", locals: { account: @buyer } %> # <%= render "account", account: @buyer %> # # # @account.to_partial_path returns 'accounts/account', so it can be used to replace: # # <%= render partial: "accounts/account", locals: { account: @account} %> # <%= render @account %> # # # @posts is an array of Post instances, so every post record returns 'posts/post' on +to_partial_path+, # # that's why we can replace: # # <%= render partial: "posts/post", collection: @posts %> # <%= render @posts %> # # == \Rendering partials with layouts # # Partials can have their own layouts applied to them. These layouts are different than the ones that are # specified globally for the entire action, but they work in a similar fashion. Imagine a list with two types # of users: # # <%# app/views/users/index.html.erb %> # Here's the administrator: # <%= render partial: "user", layout: "administrator", locals: { user: administrator } %> # # Here's the editor: # <%= render partial: "user", layout: "editor", locals: { user: editor } %> # # <%# app/views/users/_user.html.erb %> # Name: <%= user.name %> # # <%# app/views/users/_administrator.html.erb %> #
    # Budget: $<%= user.budget %> # <%= yield %> #
    # # <%# app/views/users/_editor.html.erb %> #
    # Deadline: <%= user.deadline %> # <%= yield %> #
    # # ...this will return: # # Here's the administrator: #
    # Budget: $<%= user.budget %> # Name: <%= user.name %> #
    # # Here's the editor: #
    # Deadline: <%= user.deadline %> # Name: <%= user.name %> #
    # # If a collection is given, the layout will be rendered once for each item in # the collection. For example, these two snippets have the same output: # # <%# app/views/users/_user.html.erb %> # Name: <%= user.name %> # # <%# app/views/users/index.html.erb %> # <%# This does not use layouts %> #
      # <% users.each do |user| -%> #
    • # <%= render partial: "user", locals: { user: user } %> #
    • # <% end -%> #
    # # <%# app/views/users/_li_layout.html.erb %> #
  • # <%= yield %> #
  • # # <%# app/views/users/index.html.erb %> #
      # <%= render partial: "user", layout: "li_layout", collection: users %> #
    # # Given two users whose names are Alice and Bob, these snippets return: # #
      #
    • # Name: Alice #
    • #
    • # Name: Bob #
    • #
    # # The current object being rendered, as well as the object_counter, will be # available as local variables inside the layout template under the same names # as available in the partial. # # You can also apply a layout to a block within any template: # # <%# app/views/users/_chief.html.erb %> # <%= render(layout: "administrator", locals: { user: chief }) do %> # Title: <%= chief.title %> # <% end %> # # ...this will return: # #
    # Budget: $<%= user.budget %> # Title: <%= chief.name %> #
    # # As you can see, the :locals hash is shared between both the partial and its layout. class ActionView::PartialRenderer < ::ActionView::AbstractRenderer include ::ActionView::CollectionCaching # @return [PartialRenderer] a new instance of PartialRenderer def initialize(lookup_context, options); end def collection_cache; end def collection_cache=(val); end def render(partial, context, block); end private def find_template(path, locals); end def render_partial_template(view, locals, template, layout, block); end def template_keys(_); end class << self def collection_cache; end def collection_cache=(val); end end end # = Action View PathSet # # This class is used to store and access paths in Action View. A number of # operations are defined so that you can search among the paths in this # set and also perform operations on other +PathSet+ objects. # # A +LookupContext+ will use a +PathSet+ to store the paths in its context. class ActionView::PathSet include ::Enumerable # @return [PathSet] a new instance of PathSet def initialize(paths = T.unsafe(nil)); end def +(array); end def <<(*args); end def [](*_arg0, &_arg1); end def compact; end def concat(*args); end def each(*_arg0, &_arg1); end # @return [Boolean] def exists?(path, prefixes, partial, details, details_key, locals); end def find(path, prefixes, partial, details, details_key, locals); end def find_all(path, prefixes, partial, details, details_key, locals); end def include?(*_arg0, &_arg1); end def insert(*args); end # Returns the value of attribute paths. def paths; end def pop(*_arg0, &_arg1); end def push(*args); end def size(*_arg0, &_arg1); end def to_ary; end def unshift(*args); end private def initialize_copy(other); end def search_combinations(prefixes); end def typecast(paths); end end # RecordIdentifier encapsulates methods used by various ActionView helpers # to associate records with DOM elements. # # Consider for example the following code that form of post: # # <%= form_for(post) do |f| %> # <%= f.text_field :body %> # <% end %> # # When +post+ is a new, unsaved ActiveRecord::Base instance, the resulting HTML # is: # #
    # #
    # # When +post+ is a persisted ActiveRecord::Base instance, the resulting HTML # is: # #
    # #
    # # In both cases, the +id+ and +class+ of the wrapping DOM element are # automatically generated, following naming conventions encapsulated by the # RecordIdentifier methods #dom_id and #dom_class: # # dom_id(Post.new) # => "new_post" # dom_class(Post.new) # => "post" # dom_id(Post.find 42) # => "post_42" # dom_class(Post.find 42) # => "post" # # Note that these methods do not strictly require +Post+ to be a subclass of # ActiveRecord::Base. # Any +Post+ class will work as long as its instances respond to +to_key+ # and +model_name+, given that +model_name+ responds to +param_key+. # For instance: # # class Post # attr_accessor :to_key # # def model_name # OpenStruct.new param_key: 'post' # end # # def self.find(id) # new.tap { |post| post.to_key = [id] } # end # end module ActionView::RecordIdentifier include ::ActionView::ModelNaming extend ::ActionView::RecordIdentifier extend ::ActionView::ModelNaming # The DOM class convention is to use the singular form of an object or class. # # dom_class(post) # => "post" # dom_class(Person) # => "person" # # If you need to address multiple instances of the same class in the same view, you can prefix the dom_class: # # dom_class(post, :edit) # => "edit_post" # dom_class(Person, :edit) # => "edit_person" def dom_class(record_or_class, prefix = T.unsafe(nil)); end # The DOM id convention is to use the singular form of an object or class with the id following an underscore. # If no id is found, prefix with "new_" instead. # # dom_id(Post.find(45)) # => "post_45" # dom_id(Post.new) # => "new_post" # # If you need to address multiple instances of the same class in the same view, you can prefix the dom_id: # # dom_id(Post.find(45), :edit) # => "edit_post_45" # dom_id(Post.new, :custom) # => "custom_post" def dom_id(record, prefix = T.unsafe(nil)); end private # Returns a string representation of the key attribute(s) that is suitable for use in an HTML DOM id. # This can be overwritten to customize the default generated string representation if desired. # If you need to read back a key from a dom_id in order to query for the underlying database record, # you should write a helper like 'person_record_from_dom_id' that will extract the key either based # on the default implementation (which just joins all key attributes with '_') or on your own # overwritten version of the method. By default, this implementation passes the key string through a # method that replaces all characters that are invalid inside DOM ids, with valid ones. You need to # make sure yourself that your dom ids are valid, in case you override this method. def record_key_for_dom_id(record); end end ActionView::RecordIdentifier::JOIN = T.let(T.unsafe(nil), String) ActionView::RecordIdentifier::NEW = T.let(T.unsafe(nil), String) class ActionView::RenderParser # @return [RenderParser] a new instance of RenderParser def initialize(name, code); end def render_calls; end private def directory; end def layout_to_virtual_path(layout_path); end # Convert # render("foo", ...) # into either # render(template: "foo", ...) # or # render(partial: "foo", ...) def normalize_args(string, options_hash); end def parse_hash(node); end def parse_hash_to_symbols(node); end def parse_render(node); end def parse_render_from_options(options_hash); end def parse_str(node); end def parse_sym(node); end def partial_to_virtual_path(render_type, partial_path); end # @return [Boolean] def render_template_with_layout?(render_type, options_hash); end # @return [Boolean] def render_template_with_spacer?(options_hash); end def resolve_path_directory(path); end end ActionView::RenderParser::ALL_KNOWN_KEYS = T.let(T.unsafe(nil), Array) ActionView::RenderParser::RENDER_TYPE_KEYS = T.let(T.unsafe(nil), Array) module ActionView::RenderParser::RipperASTParser extend ::ActionView::RenderParser::RipperASTParser def parse_render_nodes(code); end end class ActionView::RenderParser::RipperASTParser::Node < ::Array # @return [Node] a new instance of Node def initialize(type, arr, opts = T.unsafe(nil)); end def argument_nodes; end # @return [Boolean] def call?; end def call_method_name; end def children; end # @return [Boolean] def fcall?; end # @return [Boolean] def fcall_named?(name); end # @return [Boolean] def hash?; end def hash_from_body(body); end def inspect; end # @return [Boolean] def string?; end # @return [Boolean] def symbol?; end def to_hash; end def to_string; end def to_symbol; end # Returns the value of attribute type. def type; end def variable_name; end # @return [Boolean] def variable_reference?; end # @return [Boolean] def vcall?; end end class ActionView::RenderParser::RipperASTParser::NodeParser < ::Ripper def on_BEGIN(*args); end def on_CHAR(tok); end def on_END(*args); end def on___end__(tok); end def on_alias(*args); end def on_alias_error(*args); end def on_aref(*args); end def on_aref_field(*args); end def on_arg_ambiguous(*args); end def on_arg_paren(*args); end def on_args_add(list, item); end def on_args_add_block(list, item); end def on_args_add_star(list, item); end def on_args_forward(*args); end def on_args_new(*args); end def on_array(*args); end def on_aryptn(*args); end def on_assign(*args); end def on_assign_error(*args); end def on_assoc_new(*args); end def on_assoc_splat(*args); end def on_assoclist_from_args(*args); end def on_backref(tok); end def on_backtick(tok); end def on_bare_assoc_hash(*args); end def on_begin(*args); end def on_binary(*args); end def on_block_var(*args); end def on_blockarg(*args); end def on_bodystmt(*args); end def on_brace_block(*args); end def on_break(*args); end def on_call(*args); end def on_case(*args); end def on_class(*args); end def on_class_name_error(*args); end def on_comma(tok); end def on_command(*args); end def on_command_call(*args); end def on_comment(tok); end def on_const(tok); end def on_const_path_field(*args); end def on_const_path_ref(*args); end def on_const_ref(*args); end def on_cvar(tok); end def on_def(*args); end def on_defined(*args); end def on_defs(*args); end def on_do_block(*args); end def on_dot2(*args); end def on_dot3(*args); end def on_dyna_symbol(*args); end def on_else(*args); end def on_elsif(*args); end def on_embdoc(tok); end def on_embdoc_beg(tok); end def on_embdoc_end(tok); end def on_embexpr_beg(tok); end def on_embexpr_end(tok); end def on_embvar(tok); end def on_ensure(*args); end def on_excessed_comma(*args); end def on_fcall(*args); end def on_field(*args); end def on_float(tok); end def on_for(*args); end def on_gvar(tok); end def on_hash(*args); end def on_heredoc_beg(tok); end def on_heredoc_dedent(*args); end def on_heredoc_end(tok); end def on_hshptn(*args); end def on_ident(tok); end def on_if(*args); end def on_if_mod(*args); end def on_ifop(*args); end def on_ignored_nl(tok); end def on_ignored_sp(tok); end def on_imaginary(tok); end def on_in(*args); end def on_int(tok); end def on_ivar(tok); end def on_kw(tok); end def on_kwrest_param(*args); end def on_label(tok); end def on_label_end(tok); end def on_lambda(*args); end def on_lbrace(tok); end def on_lbracket(tok); end def on_lparen(tok); end def on_magic_comment(*args); end def on_massign(*args); end def on_method_add_arg(list, item); end def on_method_add_block(list, item); end def on_mlhs_add(list, item); end def on_mlhs_add_post(list, item); end def on_mlhs_add_star(list, item); end def on_mlhs_new(*args); end def on_mlhs_paren(*args); end def on_module(*args); end def on_mrhs_add(list, item); end def on_mrhs_add_star(list, item); end def on_mrhs_new(*args); end def on_mrhs_new_from_args(*args); end def on_next(*args); end def on_nl(tok); end def on_nokw_param(*args); end def on_op(tok); end def on_opassign(*args); end def on_operator_ambiguous(*args); end def on_param_error(*args); end def on_params(*args); end def on_paren(*args); end def on_parse_error(*args); end def on_period(tok); end def on_program(*args); end def on_qsymbols_add(list, item); end def on_qsymbols_beg(tok); end def on_qsymbols_new(*args); end def on_qwords_add(list, item); end def on_qwords_beg(tok); end def on_qwords_new(*args); end def on_rational(tok); end def on_rbrace(tok); end def on_rbracket(tok); end def on_redo(*args); end def on_regexp_add(list, item); end def on_regexp_beg(tok); end def on_regexp_end(tok); end def on_regexp_literal(*args); end def on_regexp_new(*args); end def on_rescue(*args); end def on_rescue_mod(*args); end def on_rest_param(*args); end def on_retry(*args); end def on_return(*args); end def on_return0(*args); end def on_rparen(tok); end def on_sclass(*args); end def on_semicolon(tok); end def on_sp(tok); end def on_stmts_add(list, item); end def on_stmts_new(*args); end def on_string_add(list, item); end def on_string_concat(*args); end def on_string_content(*args); end def on_string_dvar(*args); end def on_string_embexpr(*args); end def on_string_literal(*args); end def on_super(*args); end def on_symbeg(tok); end def on_symbol(*args); end def on_symbol_literal(*args); end def on_symbols_add(list, item); end def on_symbols_beg(tok); end def on_symbols_new(*args); end def on_tlambda(tok); end def on_tlambeg(tok); end def on_top_const_field(*args); end def on_top_const_ref(*args); end def on_tstring_beg(tok); end def on_tstring_content(tok); end def on_tstring_end(tok); end def on_unary(*args); end def on_undef(*args); end def on_unless(*args); end def on_unless_mod(*args); end def on_until(*args); end def on_until_mod(*args); end def on_var_alias(*args); end def on_var_field(*args); end def on_var_ref(*args); end def on_vcall(*args); end def on_void_stmt(*args); end def on_when(*args); end def on_while(*args); end def on_while_mod(*args); end def on_word_add(list, item); end def on_word_new(*args); end def on_words_add(list, item); end def on_words_beg(tok); end def on_words_new(*args); end def on_words_sep(tok); end def on_xstring_add(list, item); end def on_xstring_literal(*args); end def on_xstring_new(*args); end def on_yield(*args); end def on_yield0(*args); end def on_zsuper(*args); end end class ActionView::RenderParser::RipperASTParser::RenderCallExtractor < ::ActionView::RenderParser::RipperASTParser::NodeParser # @return [RenderCallExtractor] a new instance of RenderCallExtractor def initialize(*args); end # Returns the value of attribute render_calls. def render_calls; end private def on_arg_paren(content); end def on_command(name, *args); end def on_fcall(name, *args); end def on_paren(content); end def on_render_call(node); end end ActionView::RenderParser::RipperASTParser::RenderCallExtractor::METHODS_TO_PARSE = T.let(T.unsafe(nil), Array) # This is the main entry point for rendering. It basically delegates # to other objects like TemplateRenderer and PartialRenderer which # actually renders the template. # # The Renderer will parse the options from the +render+ or +render_body+ # method and render a partial or a template based on the options. The # +TemplateRenderer+ and +PartialRenderer+ objects are wrappers which do all # the setup and logic necessary to render a view and a new object is created # each time +render+ is called. class ActionView::Renderer # @return [Renderer] a new instance of Renderer def initialize(lookup_context); end def cache_hits; end # Returns the value of attribute lookup_context. def lookup_context; end # Sets the attribute lookup_context # # @param value the value to set the attribute lookup_context to. def lookup_context=(_arg0); end # Main render entry point shared by Action View and Action Controller. def render(context, options); end # Render but returns a valid Rack body. If fibers are defined, we return # a streaming body that renders the template piece by piece. # # Note that partials are not supported to be rendered with streaming, # so in such cases, we just wrap them in an array. def render_body(context, options); end # Direct access to partial rendering. def render_partial(context, options, &block); end def render_partial_to_object(context, options, &block); end # Direct access to template rendering. def render_template(context, options); end def render_template_to_object(context, options); end def render_to_object(context, options); end private def collection_from_object(object); end def collection_from_options(options); end end module ActionView::Rendering extend ::ActiveSupport::Concern include ::ActionView::ViewPaths mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods mixes_in_class_methods ::ActionView::Rendering::ClassMethods def initialize; end # Override process to set up I18n proxy. def process(*_arg0, &_arg1); end def render_to_body(options = T.unsafe(nil)); end # Returns the value of attribute rendered_format. def rendered_format; end # An instance of a view class. The default view class is ActionView::Base. # # The view class must have the following methods: # # * View.new(lookup_context, assigns, controller) — Create a new # ActionView instance for a controller and we can also pass the arguments. # # * View#render(option) — Returns String with the rendered template. # # Override this method in a module to change the default behavior. def view_context; end def view_context_class; end # Returns an object that is able to render templates. def view_renderer; end private # Normalize args by converting render "foo" to render :action => "foo" and # render "foo/bar" to render :template => "foo/bar". def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end # Normalize options. def _normalize_options(options); end # Assign the rendered format to look up context. def _process_format(format); end # Find and render a template based on the options given. def _render_template(options); end end module ActionView::Rendering::ClassMethods def _helpers; end def _routes; end def build_view_context_class(klass, supports_path, routes, helpers); end def view_context_class; end end # = Action View Resolver class ActionView::Resolver def all_template_paths; end def caching; end def caching=(val); end def caching?(*_arg0, &_arg1); end def clear_cache; end # Normalizes the arguments and passes it on to find_templates. def find_all(name, prefix = T.unsafe(nil), partial = T.unsafe(nil), details = T.unsafe(nil), key = T.unsafe(nil), locals = T.unsafe(nil)); end private def _find_all(name, prefix, partial, details, key, locals); end # This is what child classes implement. No defaults are needed # because Resolver guarantees that the arguments are present and # normalized. # # @raise [NotImplementedError] def find_templates(name, prefix, partial, details, locals = T.unsafe(nil)); end class << self def caching; end def caching=(val); end def caching?; end end end ActionView::Resolver::Path = ActionView::TemplatePath class ActionView::Resolver::PathParser def build_path_regex; end def parse(path); end end class ActionView::Resolver::PathParser::ParsedPath < ::Struct # Returns the value of attribute details # # @return [Object] the current value of details def details; end # Sets the attribute details # # @param value [Object] the value to set the attribute details to. # @return [Object] the newly set value def details=(_); end # Returns the value of attribute path # # @return [Object] the current value of path def path; end # Sets the attribute path # # @param value [Object] the value to set the attribute path to. # @return [Object] the newly set value def path=(_); end class << self def [](*_arg0); end def inspect; end def members; end def new(*_arg0); end end end class ActionView::StreamingBuffer # @return [StreamingBuffer] a new instance of StreamingBuffer def initialize(block); end def <<(value); end def append=(value); end def concat(value); end def html_safe; end # @return [Boolean] def html_safe?; end def safe_append=(value); end def safe_concat(value); end end class ActionView::StreamingFlow < ::ActionView::OutputFlow # @return [StreamingFlow] a new instance of StreamingFlow def initialize(view, fiber); end # 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!(key, value); end # 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(key); end private # @return [Boolean] def inside_fiber?; end end # == TODO # # * Support streaming from child templates, partials and so on. # * Rack::Cache needs to support streaming bodies class ActionView::StreamingTemplateRenderer < ::ActionView::TemplateRenderer # For streaming, instead of rendering a given a template, we return a Body # object that responds to each. This object is initialized with a block # that knows how to render the template. def render_template(view, template, layout_name = T.unsafe(nil), locals = T.unsafe(nil)); end private def delayed_render(buffer, template, layout, view, locals); end end # A valid Rack::Body (i.e. it responds to each). # It is initialized with a block that, when called, starts # rendering the template. class ActionView::StreamingTemplateRenderer::Body # @return [Body] a new instance of Body def initialize(&start); end def each(&block); end private # This is the same logging logic as in ShowExceptions middleware. def log_error(exception); end end class ActionView::SyntaxErrorInTemplate < ::ActionView::Template::Error # @return [SyntaxErrorInTemplate] a new instance of SyntaxErrorInTemplate def initialize(template, offending_code_string); end def annotated_source_code; end def message; end end # = Action View Renderable Template for objects that respond to #render_in class ActionView::Template extend ::ActiveSupport::Autoload extend ::ActionView::Template::Handlers # @return [Template] a new instance of Template def initialize(source, identifier, handler, locals:, format: T.unsafe(nil), variant: T.unsafe(nil), virtual_path: T.unsafe(nil)); end # This method is responsible for properly setting the encoding of the # source. Until this point, we assume that the source is BINARY data. # If no additional information is supplied, we assume the encoding is # the same as Encoding.default_external. # # The user can also specify the encoding via a comment on the first # with any template engine, as we process out the encoding comment # before passing the source on to the template engine, leaving a # blank line in its stead. def encode!; end # Returns the value of attribute format. def format; end # Returns the value of attribute handler. def handler; end # Returns the value of attribute identifier. def identifier; end def inspect; end # Returns the value of attribute locals. def locals; end # Exceptions are marshalled when using the parallel test runner with DRb, so we need # to ensure that references to the template object can be marshalled as well. This means forgoing # the marshalling of the compiler mutex and instantiating that again on unmarshalling. def marshal_dump; end def marshal_load(array); end # Render a template. If the template was not compiled yet, it is done # exactly before rendering. # # This method is instrumented as "!render_template.action_view". Notice that # we use a bang in this instrumentation because you don't want to # consume this in production. This is only slow if it's being listened to. def render(view, locals, buffer = T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end def short_identifier; end def source; end # Returns whether the underlying handler supports streaming. If so, # a streaming buffer *may* be passed when it starts rendering. # # @return [Boolean] def supports_streaming?; end def type; end # Returns the value of attribute variable. def variable; end # Returns the value of attribute variant. def variant; end # Returns the value of attribute virtual_path. def virtual_path; end private # Among other things, this method is responsible for properly setting # the encoding of the compiled template. # # If the template engine handles encodings, we send the encoded # String to the engine without further processing. This allows # the template engine to support additional mechanisms for # # Otherwise, after we figure out the correct encoding, we then # encode the source into Encoding.default_internal. # In general, this means that templates will be UTF-8 inside of Rails, # regardless of the original source encoding. def compile(mod); end # Compile a template. This method ensures a template is compiled # just once and removes the source after it is compiled. def compile!(view); end def handle_render_error(view, e); end def identifier_method_name; end def instrument(action, &block); end def instrument_payload; end def instrument_render_template(&block); end def locals_code; end def method_name; end class << self def frozen_string_literal; end def frozen_string_literal=(_arg0); end end end # The Template::Error exception is raised when the compilation or rendering of the template # fails. This exception then gathers a bunch of intimate details and uses it to report a # precise exception message. class ActionView::Template::Error < ::ActionView::ActionViewError # @return [Error] a new instance of Error def initialize(template); end def annotated_source_code; end # Override to prevent #cause resetting during re-raise. def cause; end def file_name; end def line_number; end def source_extract(indentation = T.unsafe(nil)); end def sub_template_message; end def sub_template_of(template_path); end private def formatted_code_for(source_code, line_counter, indent); end def source_location; end end ActionView::Template::Error::SOURCE_CODE_RADIUS = T.let(T.unsafe(nil), Integer) class ActionView::Template::HTML # @return [HTML] a new instance of HTML def initialize(string, type); end def format; end def identifier; end def inspect; end def render(*args); end def to_str; end def type; end end module ActionView::Template::Handlers def handler_for_extension(extension); end def register_default_template_handler(extension, klass); end # Register an object that knows how to handle template files with the given # extensions. This can be used to implement new template types. # The handler must respond to +:call+, which will be passed the template # and should return the rendered template as a String. # # @raise [ArgumentError] def register_template_handler(*extensions, handler); end def registered_template_handler(extension); end def template_handler_extensions; end # Opposite to register_template_handler. def unregister_template_handler(*extensions); end class << self # @private def extended(base); end def extensions; end end end class ActionView::Template::Handlers::Builder def call(template, source); end def default_format; end def default_format=(_arg0); end def default_format?; end private def require_engine; end class << self def default_format; end def default_format=(value); end def default_format?; end end end class ActionView::Template::Handlers::ERB def call(template, source); end def erb_implementation; end def erb_implementation=(_arg0); end def erb_implementation?; end def erb_trim_mode; end def erb_trim_mode=(_arg0); end def erb_trim_mode?; end def escape_ignore_list; end def escape_ignore_list=(_arg0); end def escape_ignore_list?; end # @return [Boolean] def handles_encoding?; end def strip_trailing_newlines; end def strip_trailing_newlines=(_arg0); end def strip_trailing_newlines?; end # @return [Boolean] def supports_streaming?; end private # @raise [WrongEncodingError] def valid_encoding(string, encoding); end class << self def call(template, source); end def erb_implementation; end def erb_implementation=(value); end def erb_implementation?; end def erb_trim_mode; end def erb_trim_mode=(value); end def erb_trim_mode?; end def escape_ignore_list; end def escape_ignore_list=(value); end def escape_ignore_list?; end def strip_trailing_newlines; end def strip_trailing_newlines=(value); end def strip_trailing_newlines?; end end end ActionView::Template::Handlers::ERB::ENCODING_TAG = T.let(T.unsafe(nil), Regexp) class ActionView::Template::Handlers::ERB::Erubi < ::Erubi::Engine # @return [Erubi] a new instance of Erubi def initialize(input, properties = T.unsafe(nil)); end def evaluate(action_view_erb_handler_context); end private def add_code(code); end def add_expression(indicator, code); end def add_postamble(_); end def add_text(text); end def flush_newline_if_pending(src); end end ActionView::Template::Handlers::ERB::Erubi::BLOCK_EXPR = T.let(T.unsafe(nil), Regexp) class ActionView::Template::Handlers::Html < ::ActionView::Template::Handlers::Raw def call(template, source); end end class ActionView::Template::Handlers::Raw def call(template, source); end end class ActionView::Template::Inline < ::ActionView::Template def compile(mod); end end # This finalizer is needed (and exactly with a proc inside another proc) # otherwise templates leak in development. ActionView::Template::Inline::Finalizer = T.let(T.unsafe(nil), Proc) class ActionView::Template::RawFile # @return [RawFile] a new instance of RawFile def initialize(filename); end def format; end def format=(_arg0); end def identifier; end def render(*args); end def type; end def type=(_arg0); end end class ActionView::Template::Renderable # @return [Renderable] a new instance of Renderable def initialize(renderable); end def format; end def identifier; end def render(context, *args); end end module ActionView::Template::Sources extend ::ActiveSupport::Autoload end class ActionView::Template::Sources::File # @return [File] a new instance of File def initialize(filename); end def to_s; end end class ActionView::Template::Text # @return [Text] a new instance of Text def initialize(string); end def format; end def identifier; end def inspect; end def render(*args); end def to_str; end def type; end def type=(_arg0); end end module ActionView::Template::Types class << self def [](type); end def delegate_to(klass); end def symbols; end # Returns the value of attribute type_klass. def type_klass; end # Sets the attribute type_klass # # @param value the value to set the attribute type_klass to. def type_klass=(_arg0); end end end class ActionView::Template::Types::Type # @return [Type] a new instance of Type def initialize(symbol); end def ==(type); end def ref; end # Returns the value of attribute symbol. def symbol; end def to_s; end def to_str; end def to_sym; end class << self def [](type); end end end ActionView::Template::Types::Type::SET = T.let(T.unsafe(nil), T.untyped) class ActionView::TemplateDetails # @return [TemplateDetails] a new instance of TemplateDetails def initialize(locale, handler, format, variant); end # Returns the value of attribute format. def format; end def format_or_default; end # Returns the value of attribute handler. def handler; end def handler_class; end # Returns the value of attribute locale. def locale; end # @return [Boolean] def matches?(requested); end def sort_key_for(requested); end # Returns the value of attribute variant. def variant; end end class ActionView::TemplateDetails::Requested # @return [Requested] a new instance of Requested def initialize(locale:, handlers:, formats:, variants:); end # Returns the value of attribute formats. def formats; end # Returns the value of attribute formats_idx. def formats_idx; end # Returns the value of attribute handlers. def handlers; end # Returns the value of attribute handlers_idx. def handlers_idx; end # Returns the value of attribute locale. def locale; end # Returns the value of attribute locale_idx. def locale_idx; end # Returns the value of attribute variants. def variants; end # Returns the value of attribute variants_idx. def variants_idx; end private def build_idx_hash(arr); end end ActionView::TemplateDetails::Requested::ANY_HASH = T.let(T.unsafe(nil), Hash) ActionView::TemplateError = ActionView::Template::Error # Represents a template path within ActionView's lookup and rendering system, # like "users/show" # # TemplatePath makes it convenient to convert between separate name, prefix, # partial arguments and the virtual path. class ActionView::TemplatePath # @return [TemplatePath] a new instance of TemplatePath def initialize(name, prefix, partial, virtual); end # @return [Boolean] def ==(other); end # @return [Boolean] def eql?(other); end def hash; end # Returns the value of attribute name. def name; end # Returns the value of attribute partial. def partial; end # Returns the value of attribute partial. def partial?; end # Returns the value of attribute prefix. def prefix; end # Returns the value of attribute virtual. def to_s; end # Returns the value of attribute virtual. def to_str; end # Returns the value of attribute virtual. def virtual; end # Returns the value of attribute virtual. def virtual_path; end class << self # Convert name, prefix, and partial into a TemplatePath def build(name, prefix, partial); end # Build a TemplatePath form a virtual path def parse(virtual); end # Convert name, prefix, and partial into a virtual path string def virtual(name, prefix, partial); end end end class ActionView::TemplateRenderer < ::ActionView::AbstractRenderer def render(context, options); end private # Determine the template to be rendered using the given options. def determine_template(options); end # This is the method which actually finds the layout using details in the lookup # context object. If no layout is found, it checks if at least a layout with # the given name exists across all details before raising the error. def find_layout(layout, keys, formats); end # Renders the given template. A string representing the layout can be # supplied as well. def render_template(view, template, layout_name, locals); end def render_with_layout(view, template, path, locals); end def resolve_layout(layout, keys, formats); end end class ActionView::UnboundTemplate # @return [UnboundTemplate] a new instance of UnboundTemplate def initialize(source, identifier, details:, virtual_path:); end def bind_locals(locals); end # Returns the value of attribute details. def details; end def format(*_arg0, &_arg1); end def handler(*_arg0, &_arg1); end def locale(*_arg0, &_arg1); end def variant(*_arg0, &_arg1); end # Returns the value of attribute virtual_path. def virtual_path; end private def build_template(locals); end def normalize_locals(locals); end end module ActionView::VERSION; end ActionView::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) ActionView::VERSION::MINOR = T.let(T.unsafe(nil), Integer) ActionView::VERSION::STRING = T.let(T.unsafe(nil), String) ActionView::VERSION::TINY = T.let(T.unsafe(nil), Integer) module ActionView::ViewPaths extend ::ActiveSupport::Concern mixes_in_class_methods ::ActionView::ViewPaths::ClassMethods # The prefixes used in render "foo" shortcuts. def _prefixes; end def any_templates?(*_arg0, &_arg1); end # Append a path to the list of view paths for the current LookupContext. # # ==== Parameters # * path - If a String is provided, it gets converted into # the default view path. You may also provide a custom view path # (see ActionView::PathSet for more information) def append_view_path(path); end def details_for_lookup; end def formats(*_arg0, &_arg1); end def formats=(arg); end def locale(*_arg0, &_arg1); end def locale=(arg); end # LookupContext is the object responsible for holding all # information required for looking up templates, i.e. view paths and # details. Check ActionView::LookupContext for more information. def lookup_context; end # Prepend a path to the list of view paths for the current LookupContext. # # ==== Parameters # * path - If a String is provided, it gets converted into # the default view path. You may also provide a custom view path # (see ActionView::PathSet for more information) def prepend_view_path(path); end def template_exists?(*_arg0, &_arg1); end def view_paths(*_arg0, &_arg1); end class << self def all_view_paths; end def get_view_paths(klass); end def set_view_paths(klass, paths); end end end module ActionView::ViewPaths::ClassMethods def _prefixes; end def _view_paths; end def _view_paths=(paths); end # Append a path to the list of view paths for this controller. # # ==== Parameters # * path - If a String is provided, it gets converted into # the default view path. You may also provide a custom view path # (see ActionView::PathSet for more information) def append_view_path(path); end # Prepend a path to the list of view paths for this controller. # # ==== Parameters # * path - If a String is provided, it gets converted into # the default view path. You may also provide a custom view path # (see ActionView::PathSet for more information) def prepend_view_path(path); end # A list of all of the default view paths for this controller. def view_paths; end # Set the view paths. # # ==== Parameters # * paths - If a PathSet is provided, use that; # otherwise, process the parameter into a PathSet. def view_paths=(paths); end private # Override this method in your controller if you want to change paths prefixes for finding views. # Prefixes defined here will still be added to parents' ._prefixes. def local_prefixes; end end class ActionView::WrongEncodingError < ::ActionView::EncodingError # @return [WrongEncodingError] a new instance of WrongEncodingError def initialize(string, encoding); end def message; end end