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
4 5 6 |
# File 'lib/comma/object.rb', line 4 def self.comma(style = :default, &block) (self.comma_formats ||= {})[style] = block end |
Instance Method Details
#to_comma(style = :default) ⇒ Object
8 9 10 11 |
# File 'lib/comma/object.rb', line 8 def to_comma(style = :default) raise "No comma format for class #{self.class} defined for style #{style}" unless self.comma_formats and self.comma_formats[style] Comma::DataExtractor.new(self, &self.comma_formats[style]).results end |
#to_comma_headers(style = :default) ⇒ Object
13 14 15 16 |
# File 'lib/comma/object.rb', line 13 def to_comma_headers(style = :default) raise "No comma format for class #{self.class} defined for style #{style}" unless self.comma_formats and self.comma_formats[style] Comma::HeaderExtractor.new(self, &self.comma_formats[style]).results end |