Class: HttpRouter::Node::RequestMethod
- Inherits:
-
AbstractRequestNode
- Object
- HttpRouter::Node
- AbstractRequestNode
- HttpRouter::Node::RequestMethod
- Defined in:
- lib/http_router/node/request_method.rb
Instance Attribute Summary
Attributes inherited from AbstractRequestNode
Attributes inherited from HttpRouter::Node
Instance Method Summary collapse
-
#initialize(router, parent, request_methods) ⇒ RequestMethod
constructor
A new instance of RequestMethod.
- #to_code ⇒ Object
Methods inherited from AbstractRequestNode
Methods inherited from HttpRouter::Node
#add_destination, #add_free_match, #add_glob, #add_glob_regexp, #add_host, #add_lookup, #add_match, #add_request_method, #add_scheme, #add_spanning_match, #add_user_agent, #add_variable, #depth, #inspect, #inspect_label, #inspect_matchers_body, #usable?
Constructor Details
#initialize(router, parent, request_methods) ⇒ RequestMethod
Returns a new instance of RequestMethod.
4 5 6 |
# File 'lib/http_router/node/request_method.rb', line 4 def initialize(router, parent, request_methods) super(router, parent, request_methods, :request_method) end |
Instance Method Details
#to_code ⇒ Object
8 9 10 11 12 13 |
# File 'lib/http_router/node/request_method.rb', line 8 def to_code "if #{@tests.map { |test| "#{test.inspect} === request.rack_request.#{request_method}" } * ' or '} #{super} end request.acceptable_methods.merge(#{@tests.inspect})" end |