Class: Rack::Router::PathPart
- Inherits:
-
Object
- Object
- Rack::Router::PathPart
- Defined in:
- lib/rack/router/path_part.rb
Instance Attribute Summary collapse
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
Instance Method Summary collapse
- #==(str) ⇒ Object
-
#initialize(constraint) ⇒ PathPart
constructor
A new instance of PathPart.
Constructor Details
#initialize(constraint) ⇒ PathPart
Returns a new instance of PathPart.
6 7 8 |
# File 'lib/rack/router/path_part.rb', line 6 def initialize(constraint) @constraint = constraint end |
Instance Attribute Details
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
4 5 6 |
# File 'lib/rack/router/path_part.rb', line 4 def constraint @constraint end |
Instance Method Details
#==(str) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rack/router/path_part.rb', line 10 def ==(str) return true if constraint.nil? !!constraint.call(str) rescue TypeError, ArgumentError false end |