Class: HttpRouter::Route

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

Constant Summary collapse

VALID_HTTP_VERBS =

The list of HTTP request methods supported by HttpRouter.

%w{GET POST PUT DELETE HEAD OPTIONS TRACE PATCH OPTIONS LINK UNLINK}
VALID_HTTP_VERBS_WITHOUT_GET =
VALID_HTTP_VERBS - %w{GET}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_valuesObject (readonly)

Returns the value of attribute default_values.



9
10
11
# File 'lib/http_router/route.rb', line 9

def default_values
  @default_values
end

#destObject

Returns the value of attribute dest.



10
11
12
# File 'lib/http_router/route.rb', line 10

def dest
  @dest
end

#generatorObject

Returns the value of attribute generator.



10
11
12
# File 'lib/http_router/route.rb', line 10

def generator
  @generator
end

#hostObject

Returns the value of attribute host.



10
11
12
# File 'lib/http_router/route.rb', line 10

def host
  @host
end

#ignore_trailing_slashObject

Returns the value of attribute ignore_trailing_slash.



10
11
12
# File 'lib/http_router/route.rb', line 10

def ignore_trailing_slash
  @ignore_trailing_slash
end

#match_partiallyObject

Returns the value of attribute match_partially.



9
10
11
# File 'lib/http_router/route.rb', line 9

def match_partially
  @match_partially
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/http_router/route.rb', line 9

def name
  @name
end

#original_pathObject

Returns the value of attribute original_path.



10
11
12
# File 'lib/http_router/route.rb', line 10

def original_path
  @original_path
end

#other_hostsObject (readonly)

Returns the value of attribute other_hosts.



9
10
11
# File 'lib/http_router/route.rb', line 9

def other_hosts
  @other_hosts
end

#path_for_generationObject

Returns the value of attribute path_for_generation.



10
11
12
# File 'lib/http_router/route.rb', line 10

def path_for_generation
  @path_for_generation
end

#path_validation_regexObject

Returns the value of attribute path_validation_regex.



10
11
12
# File 'lib/http_router/route.rb', line 10

def path_validation_regex
  @path_validation_regex
end

#pathsObject (readonly)

Returns the value of attribute paths.



9
10
11
# File 'lib/http_router/route.rb', line 9

def paths
  @paths
end

#request_methodsObject (readonly)

Returns the value of attribute request_methods.



9
10
11
# File 'lib/http_router/route.rb', line 9

def request_methods
  @request_methods
end

#routerObject

Returns the value of attribute router.



9
10
11
# File 'lib/http_router/route.rb', line 9

def router
  @router
end

#schemeObject

Returns the value of attribute scheme.



10
11
12
# File 'lib/http_router/route.rb', line 10

def scheme
  @scheme
end

#user_agentObject

Returns the value of attribute user_agent.



10
11
12
# File 'lib/http_router/route.rb', line 10

def user_agent
  @user_agent
end

Instance Method Details

#create_clone(new_router) ⇒ Object



13
14
15
16
17
# File 'lib/http_router/route.rb', line 13

def create_clone(new_router)
  r = clone
  r.dest = (begin; dest.clone; rescue; dest; end)
  r
end

#matches_with(var_name) ⇒ Object



23
24
25
# File 'lib/http_router/route.rb', line 23

def matches_with(var_name)
  @match_with && @match_with[:"#{var_name}"]
end

#to_sObject



19
20
21
# File 'lib/http_router/route.rb', line 19

def to_s
  "#<HttpRouter:Route #{object_id} @path_for_generation=#{path_for_generation.inspect}>"
end