Class: Usher::Interface::Rails22::Mapper
- Inherits:
-
Object
- Object
- Usher::Interface::Rails22::Mapper
- Defined in:
- lib/usher/interface/rails22/mapper.rb
Overview
:doc:
Instance Method Summary collapse
- #connect(path, options = {}) ⇒ Object
-
#initialize(set) ⇒ Mapper
constructor
:nodoc:.
-
#method_missing(route_name, *args, &proc) ⇒ Object
:nodoc:.
- #named_route(name, path, options = nil) ⇒ Object
- #namespace(name, options = {}, &block) ⇒ Object
- #root(options = {}) ⇒ Object
Constructor Details
#initialize(set) ⇒ Mapper
:nodoc:
6 7 8 |
# File 'lib/usher/interface/rails22/mapper.rb', line 6 def initialize(set) #:nodoc: @set = set end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(route_name, *args, &proc) ⇒ Object
:nodoc:
36 37 38 39 |
# File 'lib/usher/interface/rails22/mapper.rb', line 36 def method_missing(route_name, *args, &proc) #:nodoc: super unless args.length >= 1 && proc.nil? @set.add_named_route(route_name, *args) end |
Instance Method Details
#connect(path, options = {}) ⇒ Object
10 11 12 |
# File 'lib/usher/interface/rails22/mapper.rb', line 10 def connect(path, = {}) @set.add_route(path, ) end |
#named_route(name, path, options = nil) ⇒ Object
24 25 26 |
# File 'lib/usher/interface/rails22/mapper.rb', line 24 def named_route(name, path, = nil) @set.add_named_route(name, path, ) end |
#namespace(name, options = {}, &block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/usher/interface/rails22/mapper.rb', line 28 def namespace(name, = {}, &block) if [:namespace] ({:path_prefix => "#{.delete(:path_prefix)}/#{name}", :name_prefix => "#{.delete(:name_prefix)}#{name}_", :namespace => "#{.delete(:namespace)}#{name}/" }.merge(), &block) else ({:path_prefix => name, :name_prefix => "#{name}_", :namespace => "#{name}/" }.merge(), &block) end end |
#root(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/usher/interface/rails22/mapper.rb', line 14 def root( = {}) if .is_a?(Symbol) if source_route = @set.named_routes[] = source_route.conditions.blank? ? source_route..merge({ :conditions => source_route.conditions }) : source_route. end end named_route(:root, '/', ) end |