lib/array_hasher/formatter.rb in array_hasher-0.1.2 vs lib/array_hasher/formatter.rb in array_hasher-0.1.3

- old
+ new

@@ -5,11 +5,11 @@ attr_accessor :cols, :types REGEXP_EMPTY = /\A\s*\z/ TYPES = { - int: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/\A[^\d]+/, '').to_i }, - float: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/\A[^\d]+/, '').to_f }, + int: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/[^\d]+/, '').to_i }, + float: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/[^\d\.]+/, '').to_f }, string: Proc.new {|v| v.to_s }, time: Proc.new {|v| v ? Time.parse(v) : nil } } # cols: