Sha256: b9e506fe0fc80dc562f2d9b2b0c59643d6b666711a9d49cdb0a9b073468d2fe4

Contents?: true

Size: 778 Bytes

Versions: 3

Compression:

Stored size: 778 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
  module Format

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

    def self.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

3 entries across 3 versions & 1 rubygems

Version Path
osheet-1.1.1 lib/osheet/format.rb
osheet-1.1.0 lib/osheet/format.rb
osheet-1.0.0 lib/osheet/format.rb