lib/roda/plugins/optimized_segment_matchers.rb
def on_segment
          rp = @remaining_path
          if rp.getbyte(0) == 47
            if last = rp.index('/', 1)
              @remaining_path = rp[last, rp.length]
              always{yield rp[1, last-1]}
            elsif (len = rp.length) > 1
              @remaining_path = ""
              always{yield rp[1, len]}
            end
          end
        end
# Optimized version of +r.on String+ that yields the next segment if there
# is a segment.
Optimized version of +r.on String+ that yields the next segment if there
is a segment.
Optimized version of + r . on String + that yields the next segment if there is a segment .
def on_segment
          rp = @remaining_path
          if rp.getbyte(0) == 47
            if last = rp.index('/', 1)
              @remaining_path = rp[last, rp.length]
              always{yield rp[1, last-1]}
            elsif (len = rp.length) > 1
              @remaining_path = ""
              always{yield rp[1, len]}
            end
          end
        end
def on_segment rp = @remaining_path if rp . getbyte ( 0 ) == 47 if last = rp . index ( '/' , 1 ) @remaining_path = rp [ last , rp . length ] always { yield rp [ 1 , last - 1 ] } elsif ( len = rp . length ) > 1 @remaining_path = "" always { yield rp [ 1 , len ] } end end end
Optimized version of +r.on String+ that yields the next segment if there
is a segment.
Optimized version of + r . on String + that yields the next segment if there is a segment .