Class: Masticate::Relabel
Overview
relabel a single input file
-
assuming that input file has a single header line
-
assuming that input file is in valid CSV format (no validation)
Instance Attribute Summary
Attributes inherited from Base
#csv_options, #filename, #input, #input_count, #output, #output_count
Instance Method Summary collapse
Methods inherited from Base
#emit, #execute, #get, #initialize, #standard_options, #with_input
Constructor Details
This class inherits a constructor from Masticate::Base
Instance Method Details
#configure(opts) ⇒ Object
6 7 8 9 10 |
# File 'lib/masticate/relabel.rb', line 6 def configure(opts) (opts) @fields = opts[:fields] or raise "missing fieldnames for relabel" end |
#crunch(row) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/masticate/relabel.rb', line 16 def crunch(row) if !@headers @headers = @fields row = @headers end row end |
#relabel(opts) ⇒ Object
12 13 14 |
# File 'lib/masticate/relabel.rb', line 12 def relabel(opts) execute(opts) end |