method

tag_option

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: TagBuilder
tag_option(key, value, escape) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionview/lib/action_view/helpers/tag_helper.rb, line 136
        def tag_option(key, value, escape)
          key = ERB::Util.xml_name_escape(key) if escape

          case value
          when Array, Hash
            value = TagHelper.build_tag_values(value) if key.to_s == "class"
            value = escape ? safe_join(value, " ") : value.join(" ")
          when Regexp
            value = escape ? ERB::Util.unwrapped_html_escape(value.source) : value.source
          else
            value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s
          end
          value = value.gsub('"', """) if value.include?('"')

          %(#{key}="#{value}")
        end
Register or log in to add new notes.