Method: Formular::Attributes#to_html
- Defined in:
- lib/formular/attributes.rb
#to_html ⇒ Object
converts the hash into a string k1=v1 k2=v2 replaces underscores with - so we can use regular keys allows one layer of nestedhashes so we can define data options as a hash.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/formular/attributes.rb', line 24 def to_html map do |key,val| if val.is_a?(Hash) val.map do |k,v| %(#{key_to_attr_name(key)}-#{key_to_attr_name(k)}="#{val_to_string(v)}") end.join(" ") else %(#{key_to_attr_name(key)}="#{val_to_string(val)}") end end.join(" ") end |