Module: Osheet::Format

Defined in:
lib/osheet/format.rb,
lib/osheet/format/text.rb,
lib/osheet/format/custom.rb,
lib/osheet/format/number.rb,
lib/osheet/format/general.rb,
lib/osheet/format/numeric.rb,
lib/osheet/format/special.rb,
lib/osheet/format/currency.rb,
lib/osheet/format/datetime.rb,
lib/osheet/format/fraction.rb,
lib/osheet/format/accounting.rb,
lib/osheet/format/percentage.rb,
lib/osheet/format/scientific.rb

Defined Under Namespace

Classes: Accounting, Currency, Custom, Datetime, Fraction, General, Number, Numeric, Percentage, Scientific, Special, Text

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.new(type, opts = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/osheet/format.rb', line 22

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