Class: Rack::Mount::Mappers::Simple
- Inherits:
-
Object
- Object
- Rack::Mount::Mappers::Simple
- Defined in:
- lib/rack/mount/mappers/simple.rb
Instance Method Summary collapse
-
#initialize(set) ⇒ Simple
constructor
A new instance of Simple.
- #map(*args) ⇒ Object
Constructor Details
#initialize(set) ⇒ Simple
Returns a new instance of Simple.
13 14 15 |
# File 'lib/rack/mount/mappers/simple.rb', line 13 def initialize(set) @set = set end |
Instance Method Details
#map(*args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rack/mount/mappers/simple.rb', line 17 def map(*args) = args.last.is_a?(Hash) ? args.pop : {} app = [:to] path = args[0] method = args[1] defaults = [:with] requirements = [:conditions] || {} requirements.each { |k,v| requirements[k] = v.to_s unless v.is_a?(Regexp) } if path.is_a?(String) path = Utils.convert_segment_string_to_regexp(path, requirements, %w( / . ? )) end conditions = { :method => method, :path => path } @set.add_route(app, conditions, defaults) end |