# File lib/action_dispatch/routing/mapper.rb, line 376
376: def constraints(constraints = {})
377: scope(:constraints => constraints) { yield }
378: end
# File lib/action_dispatch/routing/mapper.rb, line 364
364: def controller(controller, options={})
365: options[:controller] = controller
366: scope(options) { yield }
367: end
# File lib/action_dispatch/routing/mapper.rb, line 380
380: def defaults(defaults = {})
381: scope(:defaults => defaults) { yield }
382: end
# File lib/action_dispatch/routing/mapper.rb, line 369
369: def namespace(path, options = {})
370: path = path.to_s
371: options = { :path => path, :as => path, :module => path,
372: :shallow_path => path, :shallow_prefix => path }.merge!(options)
373: scope(options) { yield }
374: end
# File lib/action_dispatch/routing/mapper.rb, line 323
323: def scope(*args)
324: options = args.extract_options!
325: options = options.dup
326:
327: if name_prefix = options.delete(:name_prefix)
328: options[:as] ||= name_prefix
329: ActiveSupport::Deprecation.warn ":name_prefix was deprecated in the new router syntax. Use :as instead.", caller
330: end
331:
332: options[:path] = args.first if args.first.is_a?(String)
333: recover = {}
334:
335: options[:constraints] ||= {}
336: unless options[:constraints].is_a?(Hash)
337: block, options[:constraints] = options[:constraints], {}
338: end
339:
340: scope_options.each do |option|
341: if value = options.delete(option)
342: recover[option] = @scope[option]
343: @scope[option] = send("merge_#{option}_scope", @scope[option], value)
344: end
345: end
346:
347: recover[:block] = @scope[:blocks]
348: @scope[:blocks] = merge_blocks_scope(@scope[:blocks], block)
349:
350: recover[:options] = @scope[:options]
351: @scope[:options] = merge_options_scope(@scope[:options], options)
352:
353: yield
354: self
355: ensure
356: scope_options.each do |option|
357: @scope[option] = recover[option] if recover.has_key?(option)
358: end
359:
360: @scope[:options] = recover[:options]
361: @scope[:blocks] = recover[:block]
362: end
# File lib/action_dispatch/routing/mapper.rb, line 397
397: def merge_as_scope(parent, child)
398: parent ? "#{parent}_#{child}" : child
399: end
# File lib/action_dispatch/routing/mapper.rb, line 425
425: def merge_blocks_scope(parent, child)
426: merged = parent ? parent.dup : []
427: merged << child if child
428: merged
429: end
# File lib/action_dispatch/routing/mapper.rb, line 417
417: def merge_constraints_scope(parent, child)
418: merge_options_scope(parent, child)
419: end
# File lib/action_dispatch/routing/mapper.rb, line 409
409: def merge_controller_scope(parent, child)
410: child
411: end
# File lib/action_dispatch/routing/mapper.rb, line 421
421: def merge_defaults_scope(parent, child)
422: merge_options_scope(parent, child)
423: end
# File lib/action_dispatch/routing/mapper.rb, line 405
405: def merge_module_scope(parent, child)
406: parent ? "#{parent}/#{child}" : child
407: end
# File lib/action_dispatch/routing/mapper.rb, line 431
431: def merge_options_scope(parent, child)
432: (parent || {}).except(*override_keys(child)).merge(child)
433: end
# File lib/action_dispatch/routing/mapper.rb, line 413
413: def merge_path_names_scope(parent, child)
414: merge_options_scope(parent, child)
415: end
# File lib/action_dispatch/routing/mapper.rb, line 389
389: def merge_path_scope(parent, child)
390: Mapper.normalize_path("#{parent}/#{child}")
391: end
# File lib/action_dispatch/routing/mapper.rb, line 393
393: def merge_shallow_path_scope(parent, child)
394: Mapper.normalize_path("#{parent}/#{child}")
395: end
# File lib/action_dispatch/routing/mapper.rb, line 401
401: def merge_shallow_prefix_scope(parent, child)
402: parent ? "#{parent}_#{child}" : child
403: end
# File lib/action_dispatch/routing/mapper.rb, line 435
435: def merge_shallow_scope(parent, child)
436: child ? true : false
437: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.