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



8
9
10
# File 'lib/comma/object.rb', line 8

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

.inherited(subclass) ⇒ Object



12
13
14
15
# File 'lib/comma/object.rb', line 12

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

Instance Method Details

#to_comma(style = :default) ⇒ Object



18
19
20
# File 'lib/comma/object.rb', line 18

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

#to_comma_headers(style = :default) ⇒ Object



22
23
24
# File 'lib/comma/object.rb', line 22

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