Class: Wayfarer::Routing::TargetRoute

Inherits:
Route
  • Object
show all
Defined in:
lib/wayfarer/routing/target_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, #action, #initialize, #leaf?, #match, #params, #root?

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

#evaluate(_path_finder) ⇒ Object



6
7
8
# File 'lib/wayfarer/routing/target_route.rb', line 6

def evaluate(_path_finder)
  true
end

#target?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/wayfarer/routing/target_route.rb', line 10

def target?
  true
end

#to_hObject



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

def to_h
  { action: case @action
            when Wayfarer::Handler then { class: @action.class.name }
            when Array then { handler: @action.first.class.name, action: @action.second }
            else @action
            end }
end