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.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/roda/plugins/class_matchers.rb', line 131

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