Module: ActionDispatch::Routing::Mapper::Base

Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/action_dispatch/routing/mapper.rb

Instance Method Summary collapse

Instance Method Details

#default_url_options=(options) ⇒ Object Also known as: default_url_options



254
255
256
# File 'lib/action_dispatch/routing/mapper.rb', line 254

def default_url_options=(options)
  @set.default_url_options = options
end

#initialize(set) ⇒ Object

:nodoc:



225
226
227
# File 'lib/action_dispatch/routing/mapper.rb', line 225

def initialize(set) #:nodoc:
  @set = set
end

#match(path, options = nil) ⇒ Object



233
234
235
236
237
# File 'lib/action_dispatch/routing/mapper.rb', line 233

def match(path, options=nil)
  mapping = Mapping.new(@set, @scope, path, options || {}).to_route
  @set.add_route(*mapping)
  self
end

#mount(app, options = nil) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/action_dispatch/routing/mapper.rb', line 239

def mount(app, options = nil)
  if options
    path = options.delete(:at)
  else
    options = app
    app, path = options.find { |k, v| k.respond_to?(:call) }
    options.delete(app) if app
  end

  raise "A rack application must be specified" unless path

  match(path, options.merge(:to => app, :anchor => false, :format => false))
  self
end

#root(options = {}) ⇒ Object



229
230
231
# File 'lib/action_dispatch/routing/mapper.rb', line 229

def root(options = {})
  match '/', options.reverse_merge(:as => :root)
end