Class: HttpRouter::RegexRoute
- Inherits:
-
Route
- Object
- Route
- HttpRouter::RegexRoute
show all
- Defined in:
- lib/http_router/regex_route.rb
Instance Attribute Summary
Attributes inherited from Route
#conditions, #default_values, #dest, #match_partially, #matches_with, #named, #original_path, #path, #regex, #router
Instance Method Summary
collapse
Methods inherited from Route
#add_to_contitions, #arbitrary, #arbitrary_with_continue, #as_options, #clone, #compiled?, #conenct, #default, #delete, #get, #head, #host, #matching, #matching_path, #name, #options, #partial, #patch, #post, #process_opts, #put, #redirect, #request_method, #scheme, #static, #to, #to_s, #trace, #url, #url_args_processing, #user_agent
Constructor Details
#initialize(router, path, opts = {}) ⇒ RegexRoute
Returns a new instance of RegexRoute.
3
4
5
6
7
8
9
|
# File 'lib/http_router/regex_route.rb', line 3
def initialize(router, path, opts = {})
@router, @original_path, @opts = router, path, opts
@param_names = @original_path.respond_to?(:names) ? @original_path.names.map(&:to_sym) : []
@path_validation_regex = original_path
Util.add_path_generation(self, self, opts.delete(:path_for_generation), @original_path) if opts.key?(:path_for_generation)
process_opts
end
|
Instance Method Details
#add_path_to_tree ⇒ Object
11
12
13
14
|
# File 'lib/http_router/regex_route.rb', line 11
def add_path_to_tree
@paths = [@original_path]
add_non_path_to_tree(@router.root.add_free_match(@original_path), path, @param_names)
end
|
#generate_from?(params) ⇒ Boolean
28
29
30
|
# File 'lib/http_router/regex_route.rb', line 28
def generate_from?(params)
false
end
|
#match_partially? ⇒ Boolean
20
21
22
|
# File 'lib/http_router/regex_route.rb', line 20
def match_partially?
true
end
|
#regex? ⇒ Boolean
24
25
26
|
# File 'lib/http_router/regex_route.rb', line 24
def regex?
true
end
|
#significant_variable_names ⇒ Object
16
17
18
|
# File 'lib/http_router/regex_route.rb', line 16
def significant_variable_names
@param_names
end
|
#url_with_params(*a) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/http_router/regex_route.rb', line 32
def url_with_params(*a)
url_args_processing(a) do |args, options|
respond_to?(:raw_url) or raise InvalidRouteException
raw_url(args, options)
end
end
|