lib/masticate/datify.rb in masticate-0.4.0 vs lib/masticate/datify.rb in masticate-0.4.1
- old
+ new
@@ -1,7 +1,6 @@
# convert date columns to numerics
-require "csv"
class Masticate::Datify < Masticate::Base
def configure(opts)
standard_options(opts)
@field = opts[:field] or raise "missing field to datify"
@@ -18,11 +17,10 @@
@index = @field.to_i
else
@index = row.index(@field) or raise "Unable to find column '#{@field}'"
end
elsif row
- ts = DateTime.strptime(row[@index], @format).to_time
- row[@index] = ts.to_i rescue nil
+ row[@index] = DateTime.strptime(row[@index], @format).to_time.to_i rescue nil
end
row
end
end