Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/comma.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.comma(style = :default, &block) ⇒ Object
33 34 35 |
# File 'lib/comma.rb', line 33 def self.comma(style = :default, &block) (self.comma_formats ||= {})[style] = block end |
Instance Method Details
#to_comma(style = :default) ⇒ Object
37 38 39 40 |
# File 'lib/comma.rb', line 37 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
42 43 44 45 |
# File 'lib/comma.rb', line 42 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 |