vendor/bundle/ruby/1.8/gems/sinatra-1.2.8/lib/sinatra/base.rb
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
If the current request matches pattern and conditions, fill params
with keys and call the given block.
Revert params afterwards.

Returns pass block.
If the current request matches pattern and conditions fill params with keys and call the given block . Revert params afterwards . Returns pass block .
def process_route(pattern, keys, conditions)
      @original_params ||= @params
      route = @request.route
      route = '/' if route.empty? and not settings.empty_path_info?
      if match = pattern.match(route)
        values = match.captures.to_a
        params =
          if keys.any?
            keys.zip(values).inject({}) do |hash,(k,v)|
              if k == 'splat'
                (hash[k] ||= []) << v
              else
                hash[k] = v
              end
              hash
            end
          elsif values.any?
            {'captures' => values}
          else
            {}
          end
        @params = @original_params.merge(params)
        @block_params = values
        catch(:pass) do
          conditions.each { |cond|
            throw :pass if instance_eval(&cond) == false }
          yield
        end
      end
    ensure
      @params = @original_params
    end
def process_route ( pattern , keys , conditions ) @original_params ||= @params route = @request . route route = '/' if route . empty? and not settings . empty_path_info? if match = pattern . match ( route ) values = match . captures . to_a params = if keys . any? keys . zip ( values ) . inject ( { } ) do | hash , ( k , v ) | if k == 'splat' ( hash [ k ] ||= [ ] ) << v else hash [ k ] = v end hash end elsif values . any? { 'captures' => values } else { } end @params = @original_params . merge ( params ) @block_params = values catch ( :pass ) do conditions . each { | cond | throw :pass if instance_eval ( & cond ) == false } yield end end ensure @params = @original_params end
If the current request matches pattern and conditions, fill params
with keys and call the given block.
If the current request matches pattern and conditions fill params with keys and call the given block .
pattern
keys
conditions