Class: Brujula::ObjectBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/brujula/object_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition:, data:, key:) ⇒ ObjectBuilder

Returns a new instance of ObjectBuilder.



5
6
7
8
9
10
# File 'lib/brujula/object_builder.rb', line 5

def initialize(definition:, data:, key:)
  @definition = definition
  @data       = data
  @key        = key
  @key_data   = extract_and_transform_data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/brujula/object_builder.rb', line 3

def data
  @data
end

#definitionObject (readonly)

Returns the value of attribute definition.



3
4
5
# File 'lib/brujula/object_builder.rb', line 3

def definition
  @definition
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/brujula/object_builder.rb', line 3

def key
  @key
end

#key_dataObject (readonly)

Returns the value of attribute key_data.



3
4
5
# File 'lib/brujula/object_builder.rb', line 3

def key_data
  @key_data
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/brujula/object_builder.rb', line 12

def call
  return nil if key_data.nil?
  return object_reference if key.referrable

  object_class.new(new_object_arguments).expand
end