Class: Shaf::ApiRoutes::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/shaf/extensions/api_routes.rb

Class Method Summary collapse

Class Method Details

.controllersObject



11
12
13
# File 'lib/shaf/extensions/api_routes.rb', line 11

def controllers
  routes.keys.sort_by(&:to_s)
end

.register(controller, method, symbol) ⇒ Object



7
8
9
# File 'lib/shaf/extensions/api_routes.rb', line 7

def register(controller, method, symbol)
  routes[controller][symbol] << method.to_s.upcase
end

.routes_for(controller) ⇒ Object



15
16
17
18
19
20
# File 'lib/shaf/extensions/api_routes.rb', line 15

def routes_for(controller)
  sorted = routes[controller].keys.sort_by(&:to_s)
  sorted.each do |symbol|
    yield route_info(controller, symbol)
  end
end