Class: Cadet::Traverser
- Inherits:
- 
      Object
      
        - Object
- Cadet::Traverser
 
- Includes:
- Enumerable
- Defined in:
- lib/cadet/traverser.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #each ⇒ Object
- #incoming(type) ⇒ Object
- 
  
    
      #initialize(nodes, direction, type)  ⇒ Traverser 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Traverser. 
- #outgoing(type) ⇒ Object
Constructor Details
#initialize(nodes, direction, type) ⇒ Traverser
Returns a new instance of Traverser.
| 5 6 7 8 9 | # File 'lib/cadet/traverser.rb', line 5 def initialize(nodes, direction, type) @nodes = nodes @direction = direction @type = type end | 
Instance Method Details
#==(other) ⇒ Object
| 24 25 26 | # File 'lib/cadet/traverser.rb', line 24 def ==(other) self.to_a == other.to_a end | 
#each ⇒ Object
| 11 12 13 14 15 | # File 'lib/cadet/traverser.rb', line 11 def each @nodes.each do |n| n.send(@direction, @type).each { |o| yield o } end end |