Module: Roda::RodaPlugins::ClassMatchers::RequestMethods

Defined in:
lib/roda/plugins/class_matchers.rb

Instance Method Summary collapse

Instance Method Details

#_consume_segment(convert_meth) ⇒ Object

Use faster approach for segment matching. This is used for matchers based on the String class matcher, and avoids the use of regular expressions for scanning.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/roda/plugins/class_matchers.rb', line 116

def _consume_segment(convert_meth)
  rp = @remaining_path
  if _match_class_String
    if convert_meth
      if captures = scope.send(convert_meth, @captures.pop)
        if captures.is_a?(Array)
          @captures.concat(captures)
        else
          @captures << captures
        end
      else
        @remaining_path = rp
        nil
      end
    else
      true
    end
  end
end