Module: Neo4j::Embedded::Property
Overview
TODO code duplication with the Neo4j::PropertyContainer, This module should extend that module by adding transaction around methods
Constant Summary
PropertyValidator::VALID_PROPERTY_VALUE_CLASSES
Instance Method Summary
collapse
tx_methods
#valid_property?, #validate_property
Instance Method Details
#[](key) ⇒ Object
12
13
14
15
|
# File 'lib/neo4j-embedded/property.rb', line 12
def [](key)
return nil unless has_property?(key.to_s)
val = to_ruby_property(key.to_s)
end
|
#[]=(k, v) ⇒ Object
Sets the property of this node. Property keys are always strings. Valid property value types are the primitives(String, Fixnum, Float, FalseClass, TrueClass) or array of those primitives.
Gotchas
27
28
29
|
# File 'lib/neo4j-embedded/property.rb', line 27
def []=(k, v)
to_java_property(k, v)
end
|
#_update_props(hash) ⇒ Object
50
51
52
53
|
# File 'lib/neo4j-embedded/property.rb', line 50
def _update_props(hash)
hash.each_pair { |k,v| to_java_property(k, v) }
hash
end
|
#neo_id ⇒ Object
60
61
62
|
# File 'lib/neo4j-embedded/property.rb', line 60
def neo_id
get_id
end
|
#props ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/neo4j-embedded/property.rb', line 32
def props
property_keys.inject({}) do |ret, key|
val = to_ruby_property(key)
ret[key.to_sym] = val
ret
end
end
|
#props=(hash) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/neo4j-embedded/property.rb', line 41
def props=(hash)
property_keys.each do |key|
remove_property(key)
end
_update_props(hash)
hash
end
|
#refresh ⇒ Object
64
65
66
|
# File 'lib/neo4j-embedded/property.rb', line 64
def refresh
end
|
#update_props(hash) ⇒ Object
55
56
57
|
# File 'lib/neo4j-embedded/property.rb', line 55
def update_props(hash)
_update_props(hash)
end
|