Class: Object

Inherits:
BasicObject
Defined in:
lib/comma/object.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.comma(style = :default, &block) ⇒ Object



10
11
12
# File 'lib/comma/object.rb', line 10

def comma(style = :default, &block)
  (self.comma_formats ||= {})[style] = block
end

.inherited(subclass) ⇒ Object



14
15
16
17
# File 'lib/comma/object.rb', line 14

def inherited(subclass)
  super
  subclass.comma_formats = self.comma_formats ? self.comma_formats.dup : {}
end

Instance Method Details

#to_comma(style = :default) ⇒ Object



20
21
22
# File 'lib/comma/object.rb', line 20

def to_comma(style = :default)
  extract_with(Comma::DataExtractor, style)
end

#to_comma_headers(style = :default) ⇒ Object



24
25
26
# File 'lib/comma/object.rb', line 24

def to_comma_headers(style = :default)
  extract_with(Comma::HeaderExtractor, style)
end