Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/kea/routes.rb

Instance Method Summary collapse

Instance Method Details

#kea_bundle(*resources) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kea/routes.rb', line 9

def kea_bundle(*resources)
  options = resources.extract_options!
  bundle = options[:bundle] || resources[0] || 'common'
  component = options[:component] || 'AppContainer'
  prerender = options[:prerender].nil? ? true : options[:prerender]

  constraint = lambda do |request|
    request.env["kea.bundle"] = bundle
    request.env["kea.component"] = component
    request.env["kea.prerender"] = prerender
    true
  end

  constraints(constraint) do
    yield
  end
end

#kea_endpoint(*resources) ⇒ Object



3
4
5
6
7
# File 'lib/kea/routes.rb', line 3

def kea_endpoint(*resources)
  path = resources[0]

  match path, to: Kea::Router.do_route, as: :kea, via: [:post]
end