Class: CSVStepImporter::Loader

Inherits:
Node
  • Object
show all
Defined in:
lib/csv_step_importer/loader.rb

Instance Attribute Summary

Attributes inherited from Node

#children, #env, #parent

Instance Method Summary collapse

Methods inherited from Node

#add_children, #build_env, #create_or_update, #run_validations!, #validate_children

Methods inherited from Base

#ancestors, #assign_attributes, #create_or_update, #inspect, #persisted?, #save, #save!, set, #to_s, #update

Constructor Details

#initialize(file_class: CSVStepImporter::File, chunk_class: CSVStepImporter::Chunk, **attributes) ⇒ Loader

Returns a new instance of Loader.



7
8
9
10
# File 'lib/csv_step_importer/loader.rb', line 7

def initialize(file_class: CSVStepImporter::File, chunk_class: CSVStepImporter::Chunk, **attributes)
  super **attributes.slice(:parent, :children, :env)
  add_children attributes[:path] ? file_class.new(**attributes.merge!(chunk_class: chunk_class)) : chunk_class.new(**attributes)
end