Class: Wayfarer::Routing::SubRoute

Inherits:
Route
  • Object
show all
Defined in:
lib/wayfarer/routing/sub_route.rb

Constant Summary

Constants inherited from Route

Route::EMPTY_PARAMS

Instance Attribute Summary

Attributes inherited from Route

#children, #matcher, #parent

Instance Method Summary collapse

Methods inherited from Route

#accept, #initialize, #leaf?, #match, #root?, #target?, #to_h

Methods included from Serializable

#to_h

Methods included from Stringify

#to_s

Methods included from DSL

#custom, #host, #path, #query, #scheme, #to, #url

Constructor Details

This class inherits a constructor from Wayfarer::Routing::Route

Instance Method Details

#action(path_finder) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/wayfarer/routing/sub_route.rb', line 22

def action(path_finder)
  handle(
    path_finder,
    match: lambda(&:action),
    mismatch: ->(_result) {}
  )
end

#evaluate(path_finder) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/wayfarer/routing/sub_route.rb', line 6

def evaluate(path_finder)
  handle(
    path_finder,
    match: ->(_result) { true },
    mismatch: ->(_result) { false }
  )
end

#params(path_finder) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/wayfarer/routing/sub_route.rb', line 14

def params(path_finder)
  handle(
    path_finder,
    match: lambda(&:params),
    mismatch: ->(_result) { EMPTY_PARAMS }
  )
end