Class: Acorn::DataProcessor
- Inherits:
-
Object
- Object
- Acorn::DataProcessor
- Defined in:
- lib/acorn/data_processor.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ DataProcessor
constructor
A new instance of DataProcessor.
- #process ⇒ Object
Constructor Details
#initialize(data) ⇒ DataProcessor
Returns a new instance of DataProcessor.
4 5 6 7 8 |
# File 'lib/acorn/data_processor.rb', line 4 def initialize data self.data = data self.data.attr_names.map! {|x| x.to_s} self.data.seed_names.map! {|x| x.to_s} end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/acorn/data_processor.rb', line 3 def data @data end |
Instance Method Details
#process ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/acorn/data_processor.rb', line 9 def process data = self.data DataValidator.new(data).validate! seed_grabber = SeedGrabber.new data.dir_name, data.seed_names seeds = seed_grabber.grab friendly = ARFriendly.new(data.attr_names, seeds).to_friendly friendly.each do |f| obj = data.ar_class.new f.each do |k,v| obj.send k.to_s + '=', v end obj.save! end end |