module ActiveGraph::UndeclaredProperties

This mixin allows storage and update of undeclared properties in the included class

Public Instance Methods

[](name)
Alias for: read_attribute
[]=(name, value)
Alias for: write_attribute
add_undeclared_property(name, value) click to toggle source
   # File lib/active_graph/undeclared_properties.rb
49 def add_undeclared_property(name, value)
50   (self.undeclared_properties ||= {})[name] = value
51 end
props_for_create() click to toggle source
Calls superclass method
   # File lib/active_graph/undeclared_properties.rb
35 def props_for_create
36   super.merge(undeclared_properties!)
37 end
props_for_update() click to toggle source
Calls superclass method
   # File lib/active_graph/undeclared_properties.rb
39 def props_for_update
40   super.merge(undeclared_properties!)
41 end
read_attribute(name) click to toggle source
Calls superclass method
   # File lib/active_graph/undeclared_properties.rb
13 def read_attribute(name)
14   respond_to?(name) ? super(name) : read_undeclared_property(name.to_sym)
15 end
Also aliased as: []
read_undeclared_property(name) click to toggle source
   # File lib/active_graph/undeclared_properties.rb
18 def read_undeclared_property(name)
19   _persisted_obj ? _persisted_obj.properties[name] : (undeclared_properties && undeclared_properties[name])
20 end
skip_update?() click to toggle source
Calls superclass method
   # File lib/active_graph/undeclared_properties.rb
31 def skip_update?
32   super && undeclared_properties.blank?
33 end
undeclared_properties!() click to toggle source
   # File lib/active_graph/undeclared_properties.rb
43 def undeclared_properties!
44   undeclared_properties || {}
45 ensure
46   self.undeclared_properties = nil
47 end
validate_attributes!(_) click to toggle source
   # File lib/active_graph/undeclared_properties.rb
10 def validate_attributes!(_)
11 end
write_attribute(name, value) click to toggle source
Calls superclass method
   # File lib/active_graph/undeclared_properties.rb
22 def write_attribute(name, value)
23   if respond_to? "#{name}="
24     super(name, value)
25   else
26     add_undeclared_property(name, value)
27   end
28 end
Also aliased as: []=