Class: Mementus::Query::Traversal
- Inherits:
-
Object
- Object
- Mementus::Query::Traversal
- Defined in:
- lib/mementus/query/traversal.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
- #add_step(step) ⇒ Object
- #adjacent ⇒ Object
- #id ⇒ Object
-
#initialize(graph) ⇒ Traversal
constructor
A new instance of Traversal.
Constructor Details
#initialize(graph) ⇒ Traversal
Returns a new instance of Traversal.
6 7 8 9 |
# File 'lib/mementus/query/traversal.rb', line 6 def initialize(graph) @graph = graph @steps = [] end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
4 5 6 |
# File 'lib/mementus/query/traversal.rb', line 4 def graph @graph end |
Instance Method Details
#add_step(step) ⇒ Object
11 12 13 14 |
# File 'lib/mementus/query/traversal.rb', line 11 def add_step(step) @steps << step self end |
#adjacent ⇒ Object
16 17 18 |
# File 'lib/mementus/query/traversal.rb', line 16 def adjacent @steps.last.to_node.adjacent end |
#id ⇒ Object
20 21 22 |
# File 'lib/mementus/query/traversal.rb', line 20 def id @steps.last.to_node.id end |