Class: HttpRouter::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/http_router/node.rb,
lib/http_router/node/root.rb,
lib/http_router/node/glob.rb,
lib/http_router/node/regex.rb,
lib/http_router/node/lookup.rb,
lib/http_router/node/request.rb,
lib/http_router/node/variable.rb,
lib/http_router/node/arbitrary.rb,
lib/http_router/node/free_regex.rb,
lib/http_router/node/glob_regex.rb,
lib/http_router/node/destination.rb,
lib/http_router/node/spanning_regex.rb

Direct Known Subclasses

Arbitrary, Destination, FreeRegex, Glob, Lookup, Regex, Request, Root, Variable

Defined Under Namespace

Classes: Arbitrary, Destination, FreeRegex, Glob, GlobRegex, Lookup, Regex, Request, Root, SpanningRegex, Variable

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Node) initialize(router, parent, matchers = [])

A new instance of Node



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

def initialize(router, parent, matchers = [])
  @router, @parent, @matchers = router, parent, matchers
end

Instance Attribute Details

- (Object) node_position (readonly)

Returns the value of attribute node_position



16
17
18
# File 'lib/http_router/node.rb', line 16

def node_position
  @node_position
end

- (Object) parent (readonly)

Returns the value of attribute parent



16
17
18
# File 'lib/http_router/node.rb', line 16

def parent
  @parent
end

- (Object) priority (readonly)

Returns the value of attribute priority



16
17
18
# File 'lib/http_router/node.rb', line 16

def priority
  @priority
end

- (Object) router (readonly)

Returns the value of attribute router



16
17
18
# File 'lib/http_router/node.rb', line 16

def router
  @router
end

Instance Method Details

- (Object) add_arbitrary(blk, allow_partial, param_names)



38
39
40
# File 'lib/http_router/node.rb', line 38

def add_arbitrary(blk, allow_partial, param_names)
  add(Arbitrary.new(@router, self, allow_partial, blk, param_names))
end

- (Object) add_destination(blk, partial)



54
55
56
# File 'lib/http_router/node.rb', line 54

def add_destination(blk, partial)
  add(Destination.new(@router, self, blk, partial))
end

- (Object) add_free_match(regexp)



50
51
52
# File 'lib/http_router/node.rb', line 50

def add_free_match(regexp)
  add(FreeRegex.new(@router, self, regexp))
end

- (Object) add_glob



26
27
28
# File 'lib/http_router/node.rb', line 26

def add_glob
  add(Glob.new(@router, self))
end

- (Object) add_glob_regexp(matcher)



30
31
32
# File 'lib/http_router/node.rb', line 30

def add_glob_regexp(matcher)
  add(GlobRegex.new(@router, self, matcher))
end

- (Object) add_lookup(part)



58
59
60
# File 'lib/http_router/node.rb', line 58

def add_lookup(part)
  add(Lookup.new(@router, self)).add(part)
end

- (Object) add_match(regexp, matching_indicies = [0], splitting_indicies = nil)



42
43
44
# File 'lib/http_router/node.rb', line 42

def add_match(regexp, matching_indicies = [0], splitting_indicies = nil)
  add(Regex.new(@router, self, regexp, matching_indicies, splitting_indicies))
end

- (Object) add_request(opts)



34
35
36
# File 'lib/http_router/node.rb', line 34

def add_request(opts)
  add(Request.new(@router, self, opts))
end

- (Object) add_spanning_match(regexp, matching_indicies = [0], splitting_indicies = nil)



46
47
48
# File 'lib/http_router/node.rb', line 46

def add_spanning_match(regexp, matching_indicies = [0], splitting_indicies = nil)
  add(SpanningRegex.new(@router, self, regexp, matching_indicies, splitting_indicies))
end

- (Object) add_variable



22
23
24
# File 'lib/http_router/node.rb', line 22

def add_variable
  add(Variable.new(@router, self))
end

- (Boolean) usable?(other)

Returns:

  • (Boolean)


62
63
64
# File 'lib/http_router/node.rb', line 62

def usable?(other)
  false
end