Class: HttpRouter::RegexRoute
- Defined in:
- lib/http_router/regex_route.rb
Instance Attribute Summary
Attributes inherited from Route
#conditions, #default_values, #matches_with, #path, #router
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(router, path, opts = {}) ⇒ RegexRoute
constructor
A new instance of RegexRoute.
- #match_partially? ⇒ Boolean
- #regex? ⇒ Boolean
Methods inherited from Route
#arbitrary, #arbitrary_with_continue, #as_options, #clone, #compiled?, #default, #delete, #dest, #get, #head, #host, #matching, #matching_path, #name, #named, #partial, #post, #put, #redirect, #request_method, #scheme, #significant_variable_names, #static, #to, #to_s, #url, #url_with_params, #user_agent
Constructor Details
#initialize(router, path, opts = {}) ⇒ RegexRoute
Returns a new instance of RegexRoute.
3 4 5 |
# File 'lib/http_router/regex_route.rb', line 3 def initialize(router, path, opts = {}) @router, @original_path, @opts = router, path, opts end |
Instance Method Details
#compile ⇒ Object
7 8 9 10 11 |
# File 'lib/http_router/regex_route.rb', line 7 def compile @param_names = @original_path.respond_to?(:names) ? @original_path.names.map(&:to_sym) : [] add_non_path_to_tree(@router.root.add_free_match(@original_path), path, @param_names) @compiled = true end |
#match_partially? ⇒ Boolean
13 14 15 |
# File 'lib/http_router/regex_route.rb', line 13 def match_partially? true end |
#regex? ⇒ Boolean
17 18 19 |
# File 'lib/http_router/regex_route.rb', line 17 def regex? true end |