Class: Cadet::RelationshipTraverser
- Inherits:
-
Object
- Object
- Cadet::RelationshipTraverser
- Includes:
- Enumerable
- Defined in:
- lib/cadet/relationship_traverser.rb
Instance Method Summary collapse
- #<<(othernode) ⇒ Object
- #each ⇒ Object
-
#initialize(node, direction, type) ⇒ RelationshipTraverser
constructor
A new instance of RelationshipTraverser.
Constructor Details
#initialize(node, direction, type) ⇒ RelationshipTraverser
Returns a new instance of RelationshipTraverser.
6 7 8 9 10 11 12 |
# File 'lib/cadet/relationship_traverser.rb', line 6 def initialize(node, direction, type) @node = node @type = type @direction = direction @relationships = node.get_relationships(direction, DynamicRelationshipType.withName(type)) end |
Instance Method Details
#<<(othernode) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cadet/relationship_traverser.rb', line 20 def << (othernode) if @direction == Direction::OUTGOING @node.create_outgoing othernode, @type elsif @direction == Direction::INCOMING othernode.create_outgoing @node, @type end end |