lib/masticate/datify.rb in masticate-0.1.0 vs lib/masticate/datify.rb in masticate-0.1.1
- old
+ new
@@ -1,14 +1,11 @@
# convert date columns to numerics
require "csv"
class Masticate::Datify < Masticate::Base
def datify(opts)
- @output = opts[:output] ? File.open(opts[:output], "w") : $stdout
- csv_options = {}
- csv_options[:col_sep] = opts[:col_sep] if opts[:col_sep]
- csv_options[:quote_char] = opts[:quote_char] || opts[:col_sep] if opts[:quote_char] || opts[:col_sep]
+ standard_options(opts)
field = opts[:field] or raise "missing field to datify"
format = opts[:format] or raise "strptime format required for parsing timestamps"
@output_count = 0
@@ -27,10 +24,10 @@
end
end
@output.close if opts[:output]
{
- :input_count => input_count,
+ :input_count => @input_count,
:output_count => @output_count
}
end
end