Class: Erlash::HashFormatter
- Inherits:
-
TemplateFormatter
- Object
- TemplateFormatter
- Erlash::HashFormatter
- Defined in:
- lib/erlash/formatters/hash_formatter.rb
Overview
ex:
{foo: "foo"} => { foo: `foo` }
Instance Attribute Summary
Attributes inherited from TemplateFormatter
#formatter, #object, #opts, #output
Instance Method Summary collapse
Methods inherited from TemplateFormatter
call, format, #format_elem, #initialize, #safe_call
Constructor Details
This class inherits a constructor from Erlash::TemplateFormatter
Instance Method Details
#format ⇒ Object
5 6 7 8 9 10 |
# File 'lib/erlash/formatters/hash_formatter.rb', line 5 def format elems = object.each_with_object([]) do |(k,v), o| o << "#{k}: #{format_elem(v)}" end "{ #{elems.join(", ")} }" end |