Module: Rack::Mount::RouteSet::Base

Included in:
Rack::Mount::RouteSet
Defined in:
lib/rack/mount/route_set.rb

Instance Method Summary collapse

Instance Method Details

#add_route(app, conditions = {}, defaults = {}, name = nil) ⇒ Object

Builder method to add a route to the set

app

A valid Rack app to call if the conditions are met.

conditions

A hash of conditions to match against. Conditions may be expressed as strings or regexps to match against.

defaults

A hash of values that always gets merged in

name

Symbol identifier for the route used with named route generations



25
26
27
# File 'lib/rack/mount/route_set.rb', line 25

def add_route(app, conditions = {}, defaults = {}, name = nil)
  Route.new(app, conditions, defaults, name)
end

#initialize(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/rack/mount/route_set.rb', line 5

def initialize(options = {})
  if options.delete(:optimize) == true
    extend Generation::Optimizations
  end

  if block_given?
    yield self
    freeze
  end
end