Method: Helper::Helper#attributize

Defined in:
lib/helper/helper.rb

#attributize(hash) ⇒ String

Takes a hash as input and returns a string, which can be included in a html tag.

Examples:

attributize :style => 'border: none;', :class => 'foo' #=> 'style="border: none;" class="foo"'

Parameters:

  • hash (Hash)

Returns:



224
225
226
# File 'lib/helper/helper.rb', line 224

def attributize(hash)
  hash.map{|k,v| "#{k}=\"#{v}\""}.join ' '
end