Sha256: 9bd22cad1cf579fdf35682fa8d86bf7b721d8db41dfaa80306e813eec0486141
Contents?: true
Size: 768 Bytes
Versions: 2
Compression:
Stored size: 768 Bytes
Contents
module Commute # Internal: A Path is that wraps some enums and # returns there values in the order that you added them. # class Path # Internal: Initialize the path with a main route. # # main - An enumerable to start the path with. # def initialize main @path = [] self << main end # Internal: Push a route on the path (detour). # # route - An enumerable to walk first before continuing. def << route @path << route end # Internal: Figures out the successor in the path. # # Returns the next stop on the path. def succ begin return nil if @path.empty? @path.last.next rescue StopIteration @path.pop retry end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
commute-0.3.0.pre.2 | lib/commute/core/util/path.rb |
commute-0.3.0.pre | lib/commute/core/util/path.rb |