Class: Wayfarer::Routing::Matchers::Custom
- Inherits:
-
Object
- Object
- Wayfarer::Routing::Matchers::Custom
- Includes:
- EmptyParams, Stringify
- Defined in:
- lib/wayfarer/routing/matchers/custom.rb
Instance Attribute Summary collapse
-
#delegate ⇒ Object
readonly
Returns the value of attribute delegate.
Instance Method Summary collapse
- #evaluate(path_finder) ⇒ Object
-
#initialize(delegate) ⇒ Custom
constructor
A new instance of Custom.
- #to_h ⇒ Object
Methods included from EmptyParams
Methods included from Stringify
Constructor Details
#initialize(delegate) ⇒ Custom
Returns a new instance of Custom.
12 13 14 |
# File 'lib/wayfarer/routing/matchers/custom.rb', line 12 def initialize(delegate) @delegate = delegate end |
Instance Attribute Details
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
10 11 12 |
# File 'lib/wayfarer/routing/matchers/custom.rb', line 10 def delegate @delegate end |
Instance Method Details
#evaluate(path_finder) ⇒ Object
16 17 18 19 20 |
# File 'lib/wayfarer/routing/matchers/custom.rb', line 16 def evaluate(path_finder) Wayfarer::Routing::RootRoute.new.tap do |route| delegate.call(route, path_finder.uri, path_finder.task) end end |
#to_h ⇒ Object
22 23 24 |
# File 'lib/wayfarer/routing/matchers/custom.rb', line 22 def to_h { custom: delegate.class.name } end |