Sha256: 00d6008a237bd17e32c2fea44c96ceb259cb7db788603468e964a056348ce2ea

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 Bytes

Contents

require 'osheet/format/general'
require 'osheet/format/number'
require 'osheet/format/currency'
require 'osheet/format/accounting'
require 'osheet/format/datetime'
require 'osheet/format/percentage'
require 'osheet/format/fraction'
require 'osheet/format/scientific'
require 'osheet/format/text'
require 'osheet/format/special'
require 'osheet/format/custom'

module Osheet::Format

  VALUES = [
    :general, :number, :currency, :accounting,
    :datetime, :percentage, :fraction, :scientific,
    :text, :special, :custom
  ]

  class << self
    def new(type, *args)
      unless VALUES.include?(type.to_sym)
        raise ArgumentError, "'#{type.inspect}' is not a valid format type"
      end
      self.const_get(type.to_s.capitalize).new(*args)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osheet-1.0.0.rc.4 lib/osheet/format.rb
osheet-1.0.0.rc.3 lib/osheet/format.rb