Class: RubyPitaya::RoutesBase
- Inherits:
-
Object
- Object
- RubyPitaya::RoutesBase
- Defined in:
- lib/rubypitaya/core/routes_base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #get_new_handler_name(handler_name) ⇒ Object
-
#initialize ⇒ RoutesBase
constructor
A new instance of RoutesBase.
- #match(route_name, to:) ⇒ Object
- #setup ⇒ Object
Constructor Details
#initialize ⇒ RoutesBase
Returns a new instance of RoutesBase.
6 7 8 9 10 |
# File 'lib/rubypitaya/core/routes_base.rb', line 6 def initialize @handler_name_map = {} setup end |
Instance Method Details
#get_new_handler_name(handler_name) ⇒ Object
24 25 26 27 28 |
# File 'lib/rubypitaya/core/routes_base.rb', line 24 def get_new_handler_name(handler_name) return handler_name unless @handler_name_map.include?(handler_name) @handler_name_map[handler_name] end |
#match(route_name, to:) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/rubypitaya/core/routes_base.rb', line 15 def match(route_name, to:) handler_name, action_name = to.split('#') new_handler_name, new_action_name = route_name.split('.') if new_action_name.nil? set_handler_name(handler_name, new_handler_name) end end |
#setup ⇒ Object
12 13 |
# File 'lib/rubypitaya/core/routes_base.rb', line 12 def setup end |