Module: Unitwise::Standard::Extras
- Included in:
- Base
- Defined in:
- lib/unitwise/standard/extras.rb
Instance Method Summary collapse
Instance Method Details
#hash_to_markup(hash) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/unitwise/standard/extras.rb', line 3 def hash_to_markup(hash) hash.map do |k,v| if v.respond_to?(:to_xml) "<#{k}>#{v.to_xml}</#{k}>" elsif v.respond_to?(:map) v.map do |i| "<#{k}>#{i}</#{k}>" end.join('') else "<#{k}>#{v}</#{k}>" end end.join('') end |