Class: Chaplin::Parser::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/chaplin/parser/router.rb

Instance Method Summary collapse

Constructor Details

#initialize(routes_declarations, pages, redirects) ⇒ Router

Returns a new instance of Router.



10
11
12
13
14
# File 'lib/chaplin/parser/router.rb', line 10

def initialize(routes_declarations, pages, redirects)
  @routes_declarations = routes_declarations
  @pages = pages
  @redirects = redirects
end

Instance Method Details

#routesObject



16
17
18
19
20
21
22
# File 'lib/chaplin/parser/router.rb', line 16

def routes
  {}.tap do |routes|
    @routes_declarations.each do |endpoint, response_name|
      routes[build_endpoint(endpoint)] = response(response_name)
    end
  end
end