Class: TabularData::Strategies::ReaderStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/tabular_data.rb

Direct Known Subclasses

ArrayStrategy, CSVStrategy

Instance Method Summary collapse

Instance Method Details

#call(context, attributes_to_parse, attributes, &block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tabular_data.rb', line 23

def call(context, attributes_to_parse, attributes, &block)
    block = lambda{ |attribute, value| value } unless block_given?
    attributes_to_parse = parse_attributes(attributes_to_parse)
    attributes.each_with_index do |attribute, i|
				    context.send "#{attribute}=", block.call(attribute, attributes_to_parse[i])
			    end
end

#parse_attributes(attributes) ⇒ Object

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/tabular_data.rb', line 31

def parse_attributes(attributes)
    raise NotImplementedError.new("Not implemented yet.")
end