Class: Para::Routing::ComponentNameConstraint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component) ⇒ ComponentNameConstraint

Returns a new instance of ComponentNameConstraint.



13
14
15
# File 'lib/para/routing/component_name_constraint.rb', line 13

def initialize(component)
  @component = component.to_s
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



11
12
13
# File 'lib/para/routing/component_name_constraint.rb', line 11

def component
  @component
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/para/routing/component_name_constraint.rb', line 17

def matches?(request)
  component == request.params[:component]
end