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



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

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

.inherited(subclass) ⇒ Object



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

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

Instance Method Details

#to_comma(style = :default) ⇒ Object



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

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

#to_comma_headers(style = :default) ⇒ Object



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

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