Sha256: 9c3c98a44c72ac1ae3635815b922bcb609081e3987517870259e68922ecd5ff4

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module ActionView::Helpers::TagHelper
  BOOLEAN_ATTRIBUTES.merge(['itemscope', :itemscope])

  private
  def tag_options(options, escape = true)
    #p [options, escape, BOOLEAN_ATTRIBUTES]
    unless options.blank?
      attrs = []
      options.each_pair do |key, value|
        if BOOLEAN_ATTRIBUTES.include?(key)
          attrs << key.to_s if value
        elsif !value.nil?
          final_value = value.is_a?(Array) ? value.join(" ") : value
          final_value = html_escape(final_value) if escape
          attrs << %(#{key}="#{final_value}")
        end
      end

      " #{attrs.sort * ' '}".html_safe unless attrs.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
green_monkey-0.1 lib/green_monkey/ext/action_view.rb