Module: N4j::Relationship
- Extended by:
- ActiveSupport::Concern
- Included in:
- GenericRelationship
- Defined in:
- lib/n4j/relationship.rb
Defined Under Namespace
Modules: ClassMethods, Populate
Instance Method Summary
collapse
Instance Method Details
#body_hash ⇒ Object
39
40
41
|
# File 'lib/n4j/relationship.rb', line 39
def body_hash
{:to => self.end.path, :data => data, :type => type}
end
|
#create_path ⇒ Object
34
35
36
37
|
# File 'lib/n4j/relationship.rb', line 34
def create_path
start.from_neo4j_relative['create_relationship'] ||
"#{start.path}/relationships"
end
|
#entity_type ⇒ Object
26
27
28
|
# File 'lib/n4j/relationship.rb', line 26
def entity_type
'relationship'
end
|
#initialize(hsh) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/n4j/relationship.rb', line 15
def initialize(hsh)
if N4j.neo4j_hash?(hsh)
super(hsh)
else
opts = HashWithIndifferentAccess.new.merge(hsh)
opts.each_pair do |k,v|
send("#{k}=",v) if %w(start end data type).include?(k)
end
end
end
|
#prerequisites ⇒ Object
30
31
32
|
# File 'lib/n4j/relationship.rb', line 30
def prerequisites
[self.start, self.end]
end
|
#type ⇒ Object
43
44
45
|
# File 'lib/n4j/relationship.rb', line 43
def type
@type ||= self.class.model_name.i18n_key
end
|