Module: Neo4j::Shared::Property
Defined Under Namespace
Modules: ClassMethods
Classes: MultiparameterAssignmentError, UndefinedPropertyError
Constant Summary
Constants included
from Attributes
Attributes::DEPRECATED_OBJECT_METHODS
Instance Attribute Summary collapse
Instance Method Summary
collapse
class_methods
#attribute_before_type_cast
Methods included from Attributes
#==, #attributes, #query_attribute, #write_attribute
#assign_attributes, #attributes=
Instance Attribute Details
#_persisted_obj ⇒ Object
Returns the value of attribute _persisted_obj.
12
13
14
|
# File 'lib/neo4j/shared/property.rb', line 12
def _persisted_obj
@_persisted_obj
end
|
Instance Method Details
#initialize(attributes = nil) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/neo4j/shared/property.rb', line 23
def initialize(attributes = nil)
attributes = process_attributes(attributes)
modded_attributes = inject_defaults!(attributes)
validate_attributes!(modded_attributes)
writer_method_props = (modded_attributes)
send_props(writer_method_props)
@_persisted_obj = nil
end
|
#inject_defaults!(starting_props) ⇒ Object
32
33
34
35
|
# File 'lib/neo4j/shared/property.rb', line 32
def inject_defaults!(starting_props)
return starting_props if self.class.declared_properties.declared_property_defaults.empty?
self.class.declared_properties.inject_defaults!(self, starting_props || {})
end
|
#inspect ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/neo4j/shared/property.rb', line 14
def inspect
attribute_descriptions = inspect_attributes.map do |key, value|
"#{Neo4j::ANSI::CYAN}#{key}: #{Neo4j::ANSI::CLEAR}#{value.inspect}"
end.join(', ')
separator = ' ' unless attribute_descriptions.empty?
"#<#{Neo4j::ANSI::YELLOW}#{self.class.name}#{Neo4j::ANSI::CLEAR}#{separator}#{attribute_descriptions}>"
end
|
#read_attribute(name) ⇒ Object
Also known as:
[]
37
38
39
|
# File 'lib/neo4j/shared/property.rb', line 37
def read_attribute(name)
respond_to?(name) ? send(name) : nil
end
|
#reload_properties!(properties) ⇒ Object
47
48
49
50
|
# File 'lib/neo4j/shared/property.rb', line 47
def reload_properties!(properties)
@attributes = nil
convert_and_assign_attributes(properties)
end
|
#send_props(hash) ⇒ Object
42
43
44
45
|
# File 'lib/neo4j/shared/property.rb', line 42
def send_props(hash)
return hash if hash.blank?
hash.each { |key, value| send("#{key}=", value) }
end
|