lib/osheet/format.rb in osheet-1.0.0.rc.4 vs lib/osheet/format.rb in osheet-1.0.0

- old
+ new

@@ -8,23 +8,23 @@ require 'osheet/format/scientific' require 'osheet/format/text' require 'osheet/format/special' require 'osheet/format/custom' -module Osheet::Format +module Osheet + module Format - VALUES = [ - :general, :number, :currency, :accounting, - :datetime, :percentage, :fraction, :scientific, - :text, :special, :custom - ] + VALUES = [ + :general, :number, :currency, :accounting, + :datetime, :percentage, :fraction, :scientific, + :text, :special, :custom + ] - class << self - def new(type, *args) + 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 end