Class: Terrestrial::GraphLoader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datasets:, mappings:, object_load_pipeline:) ⇒ GraphLoader

Returns a new instance of GraphLoader.



3
4
5
6
7
# File 'lib/terrestrial/graph_loader.rb', line 3

def initialize(datasets:, mappings:, object_load_pipeline:)
  @datasets = datasets
  @mappings = mappings
  @object_load_pipeline = object_load_pipeline
end

Instance Attribute Details

#datasetsObject (readonly)

Returns the value of attribute datasets.



9
10
11
# File 'lib/terrestrial/graph_loader.rb', line 9

def datasets
  @datasets
end

#mappingsObject (readonly)

Returns the value of attribute mappings.



9
10
11
# File 'lib/terrestrial/graph_loader.rb', line 9

def mappings
  @mappings
end

#object_load_pipelineObject (readonly)

Returns the value of attribute object_load_pipeline.



9
10
11
# File 'lib/terrestrial/graph_loader.rb', line 9

def object_load_pipeline
  @object_load_pipeline
end

Instance Method Details

#call(mapping_name, record, eager_data_graph = {}) ⇒ Object



11
12
13
14
15
# File 'lib/terrestrial/graph_loader.rb', line 11

def call(mapping_name, record, eager_data_graph = {})
  mapping = mappings.fetch(mapping_name)

  load_record(mapping, record, eager_data_graph)
end