Class: HttpRouter::RegexRoute

Inherits:
Route
  • Object
show all
Defined in:
lib/http_router/regex_route.rb

Instance Attribute Summary

Attributes inherited from Route

#conditions, #default_values, #matches_with, #original_path, #path, #router

Instance Method Summary collapse

Methods inherited from Route

#arbitrary, #arbitrary_with_continue, #as_options, #clone, #compiled?, #default, #delete, #dest, #get, #head, #host, #matching, #matching_path, #name, #named, #options, #partial, #patch, #post, #process_opts, #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
6
# File 'lib/http_router/regex_route.rb', line 3

def initialize(router, path, opts = {})
  @router, @original_path, @opts = router, path, opts
  process_opts
end

Instance Method Details

#compileObject



8
9
10
11
12
# File 'lib/http_router/regex_route.rb', line 8

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/http_router/regex_route.rb', line 14

def match_partially?
  true
end

#regex?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/http_router/regex_route.rb', line 18

def regex?
  true
end