Class: RubyPitaya::RoutesBase

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/core/routes_base.rb

Direct Known Subclasses

Routes

Instance Method Summary collapse

Constructor Details

#initializeRoutesBase

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

#setupObject



12
13
# File 'lib/rubypitaya/core/routes_base.rb', line 12

def setup
end