Class: Neon::Relationship::Rest
- Inherits:
-
Object
- Object
- Neon::Relationship::Rest
- Includes:
- PropertyContainer::Rest
- Defined in:
- lib/neon/relationship/rest.rb
Instance Attribute Summary collapse
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(relationship, session) ⇒ Rest
constructor
A new instance of Rest.
- #other_node(node) ⇒ Object
- #to_s ⇒ Object
Methods included from PropertyContainer::Rest
#==, #[], #[]=, #del, #destroy, #props, #props=
Methods included from TransactionHelpers::Rest
Constructor Details
#initialize(relationship, session) ⇒ Rest
Returns a new instance of Rest.
9 10 11 12 13 14 15 16 17 |
# File 'lib/neon/relationship/rest.rb', line 9 def initialize(relationship, session) @relationship = relationship @session = session @id = @relationship["self"].split('/').last.to_i # Set the id @start = @session.load(@relationship["start"]) @end = @session.load(@relationship["end"]) @nodes = [@start, @end] @type = @relationship["type"] end |
Instance Attribute Details
#end ⇒ Object (readonly)
Returns the value of attribute end.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def end @end end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def id @id end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def nodes @nodes end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def session @session end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def start @start end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/neon/relationship/rest.rb', line 7 def type @type end |
Instance Method Details
#other_node(node) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/neon/relationship/rest.rb', line 19 def other_node(node) case node when @start @end when @end @start else nil end rescue NoMethodError => e _raise_doesnt_exist_anymore_error(e) end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/neon/relationship/rest.rb', line 33 def to_s "REST Relationship[#{@id}]" end |