Sha256: 97c7e7d6f05cb5d9c5a924165a98e7b00e501bc20960d5319e03daa0fc524f7c

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 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 = ERB::Util.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

3 entries across 3 versions & 1 rubygems

Version Path
green_monkey-0.1.3 lib/green_monkey/ext/action_view.rb
green_monkey-0.1.2 lib/green_monkey/ext/action_view.rb
green_monkey-0.1.1 lib/green_monkey/ext/action_view.rb