Module: ActiveGraph::Node::Initialize

Extended by:
ActiveSupport::Concern
Includes:
Shared::Initialize
Included in:
ActiveGraph::Node
Defined in:
lib/active_graph/node/initialize.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared::Initialize

#wrapper

Instance Attribute Details

#called_byObject (readonly)

Returns the value of attribute called_by.



5
6
7
# File 'lib/active_graph/node/initialize.rb', line 5

def called_by
  @called_by
end

Instance Method Details

#init_on_load(persisted_node, properties) ⇒ Object

called when loading the node from the database

Parameters:

  • persisted_node (ActiveGraph::Node)

    the node this class wraps

  • properties (Hash)

    of the persisted node.



10
11
12
13
14
15
# File 'lib/active_graph/node/initialize.rb', line 10

def init_on_load(persisted_node, properties)
  self.class.extract_association_attributes!(properties)
  @_persisted_obj = persisted_node
  changed_attributes_clear!
  @attributes = convert_and_assign_attributes(properties)
end

#init_on_reload(reloaded) ⇒ Object



17
18
19
20
# File 'lib/active_graph/node/initialize.rb', line 17

def init_on_reload(reloaded)
  @attributes = nil
  init_on_load(reloaded, reloaded.properties)
end