Class: RubyRoutesTrie::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/trie/node.rb

Constant Summary collapse

DYNAMIC =
1
STATIC =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Node

Returns a new instance of Node.



10
11
12
13
14
15
16
# File 'lib/trie/node.rb', line 10

def initialize(value)
  @children      = []
  @value         = value
  @method        = ''
  @route         = ''
  @type          = value[0] == ':' ? DYNAMIC : STATIC
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



6
7
8
# File 'lib/trie/node.rb', line 6

def children
  @children
end

#methodObject

Returns the value of attribute method.



8
9
10
# File 'lib/trie/node.rb', line 8

def method
  @method
end

#routeObject

Returns the value of attribute route.



8
9
10
# File 'lib/trie/node.rb', line 8

def route
  @route
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/trie/node.rb', line 8

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/trie/node.rb', line 6

def value
  @value
end

Instance Method Details

#dynamic?Boolean

Returns:

  • (Boolean)


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

def dynamic?
  @type == DYNAMIC
end