class Pipeline::Parser::CSVParser
Attributes
attribute_matrix[RW]
items[RW]
model[RW]
Public Class Methods
new()
click to toggle source
# File lib/etl-pipeline.rb, line 12 def initialize @attribute_matrix = Hash.new @items = Array.new end
Public Instance Methods
coerce(input, output)
click to toggle source
# File lib/etl-pipeline.rb, line 17 def coerce(input, output) @attribute_matrix.each do |attr, prok| end end
match(attribute, prok)
click to toggle source
# File lib/etl-pipeline.rb, line 34 def match(attribute, prok) @attribute_matrix[attribute.to_sym] = prok end
parse(file_path, options={}) { |csv| ... }
click to toggle source
# File lib/etl-pipeline.rb, line 22 def parse(file_path, options={}) CSV.foreach(file_path, options) do |csv| obj = @model.new coerce csv, obj yield csv end end
register_model(model)
click to toggle source
# File lib/etl-pipeline.rb, line 30 def register_model(model) self.model = model end