Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/fiddler/extensions/hash.rb
Instance Method Summary collapse
Instance Method Details
#to_content_format ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fiddler/extensions/hash.rb', line 2 def to_content_format fields = self.map do |key,value| unless value.nil? value = Fiddler::Formatters::BaseFormatter.format_string(value.to_s) if key.to_s.match(/^cf_.+/) "CF-#{key.to_s[3..key.to_s.length].gsub(/_/, " ").camelize.humanize}: #{value}" else "#{key.to_s.camelize}: #{value}" end end end content = fields.compact.sort.join("\n") end |