Sha256: 30b063d6e98505101dfb3b41bc59a4d023604327d7fdcf8fa35c97e208de088f

Contents?: true

Size: 649 Bytes

Versions: 8

Compression:

Stored size: 649 Bytes

Contents

class Object
  class_attribute :comma_formats

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

  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

  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
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
comma-3.0.6 lib/comma/object.rb
comma-3.0.5 lib/comma/object.rb
comma-3.0.4 lib/comma/object.rb
comma-3.0.3 lib/comma/object.rb
comma-3.0.2 lib/comma/object.rb
comma-3.0.1 lib/comma/object.rb
comma-3.0.0 lib/comma/object.rb
vibedeck-comma-0.4.2 lib/comma/object.rb