Class: Panda::Routing::Mapper
Instance Attribute Summary collapse
-
#endpoints ⇒ Object
readonly
Returns the value of attribute endpoints.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(endpoints) ⇒ Mapper
constructor
A new instance of Mapper.
- #perform(request) ⇒ Object
Constructor Details
#initialize(endpoints) ⇒ Mapper
Returns a new instance of Mapper.
6 7 8 |
# File 'lib/panda/routing/mapper.rb', line 6 def initialize(endpoints) @endpoints = endpoints end |
Instance Attribute Details
#endpoints ⇒ Object (readonly)
Returns the value of attribute endpoints.
4 5 6 |
# File 'lib/panda/routing/mapper.rb', line 4 def endpoints @endpoints end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/panda/routing/mapper.rb', line 4 def request @request end |
Instance Method Details
#perform(request) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/panda/routing/mapper.rb', line 10 def perform(request) @request = request path = request.path_info verb = request.request_method endpoints[verb].detect do |endpoint| match_path_with_endpoint(path, endpoint) end end |