Class: Sprig::Seed::Factory
- Inherits:
-
Object
- Object
- Sprig::Seed::Factory
- Defined in:
- lib/sprig/seed/factory.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_seeds_to_hopper(hopper) ⇒ Object
-
#initialize(klass, datasource, options) ⇒ Factory
constructor
A new instance of Factory.
Constructor Details
#initialize(klass, datasource, options) ⇒ Factory
Returns a new instance of Factory.
14 15 16 17 18 |
# File 'lib/sprig/seed/factory.rb', line 14 def initialize(klass, datasource, ) self.klass = klass self.datasource = datasource self. = end |
Class Method Details
.new_from_directive(directive) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/sprig/seed/factory.rb', line 4 def self.new_from_directive(directive) raise ArgumentError, 'Must provide a Directive' unless directive.is_a? Directive new( directive.klass, directive.datasource, directive. ) end |
Instance Method Details
#add_seeds_to_hopper(hopper) ⇒ Object
20 21 22 23 24 |
# File 'lib/sprig/seed/factory.rb', line 20 def add_seeds_to_hopper(hopper) datasource.records.each do |record_data| hopper << Entry.new(klass, record_data, ) end end |