Sha256: 7a1e01459c3453a6eaa05d0115c0da855252d696be7b750068e327615627ce3d

Contents?: true

Size: 475 Bytes

Versions: 14

Compression:

Stored size: 475 Bytes

Contents

# 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)

class Masticate::Relabel < Masticate::Base
  def configure(opts)
    standard_options(opts)

    @fields = opts[:fields] or raise "missing fieldnames for relabel"
  end

  def relabel(opts)
    execute(opts)
  end

  def crunch(row)
    if !@headers
      @headers = @fields
      row = @headers
    end
    row
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
masticate-0.6.2 lib/masticate/relabel.rb
masticate-0.6.1 lib/masticate/relabel.rb
masticate-0.6.0 lib/masticate/relabel.rb
masticate-0.5.1 lib/masticate/relabel.rb
masticate-0.5.0 lib/masticate/relabel.rb
masticate-0.4.2 lib/masticate/relabel.rb
masticate-0.4.1 lib/masticate/relabel.rb
masticate-0.4.0 lib/masticate/relabel.rb
masticate-0.3.2 lib/masticate/relabel.rb
masticate-0.3.1 lib/masticate/relabel.rb
masticate-0.3 lib/masticate/relabel.rb
masticate-0.2.3 lib/masticate/relabel.rb
masticate-0.2.2 lib/masticate/relabel.rb
masticate-0.2.1 lib/masticate/relabel.rb