Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/comma/object.rb
Class Method Summary collapse
Instance Method Summary collapse
- #comma_formats ⇒ Object
- #to_comma(style = :default) ⇒ Object
- #to_comma_headers(style = :default) ⇒ Object
Class Method Details
.comma(style = :default, &block) ⇒ Object
8 9 10 |
# File 'lib/comma/object.rb', line 8 def comma(style = :default, &block) own_comma_formats[style] = block end |
.comma_formats ⇒ Object
12 13 14 15 16 |
# File 'lib/comma/object.rb', line 12 def comma_formats classes_with_own_formats.reverse_each.each_with_object({}) do |klass, formats| formats.merge!(klass.instance_variable_get(:@own_comma_formats)) end end |
Instance Method Details
#comma_formats ⇒ Object
40 41 42 |
# File 'lib/comma/object.rb', line 40 def comma_formats self.class.comma_formats end |
#to_comma(style = :default) ⇒ Object
44 45 46 |
# File 'lib/comma/object.rb', line 44 def to_comma(style = :default) extract_with(Comma::DataExtractor, style) end |
#to_comma_headers(style = :default) ⇒ Object
48 49 50 |
# File 'lib/comma/object.rb', line 48 def to_comma_headers(style = :default) extract_with(Comma::HeaderExtractor, style) end |