Class: Routes::ParamsConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/routing/params.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ParamsConstraint

Returns a new instance of ParamsConstraint.


3
4
5
# File 'lib/routing/params.rb', line 3

def initialize(params = {})
  @params = params.stringify_keys
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)

7
8
9
10
11
# File 'lib/routing/params.rb', line 7

def matches?(request)
  !@params.detect do |key, value|
    value != request.query_parameters[key] && value != request.request_parameters[key]
  end
end