Class: Materialize::BaseBuilder

Inherits:
Object
  • Object
show all
Extended by:
Concurrent
Defined in:
lib/materialize/base_builder.rb

Class Method Summary collapse

Methods included from Concurrent

concurrent

Class Method Details

.build(data, repo, options) ⇒ Object



6
7
8
9
# File 'lib/materialize/base_builder.rb', line 6

def build(data, repo, options)
  data = data.merge({ __repo__: repo, __options__: options })
  entity_class.new(data)
end

.build_all(data, repo, options) ⇒ Object



11
12
13
14
# File 'lib/materialize/base_builder.rb', line 11

def build_all(data, repo, options)
  datas = data.map { |d| d.merge({ __repo__: repo, __options__: options }) }
  entity_class.wrap(datas)
end

.entity_classObject



16
17
18
# File 'lib/materialize/base_builder.rb', line 16

def entity_class
  "Entities::#{entity_base_class_name}".split('::').reduce(Module, :const_get)
end