Method: Syntax::Node#parse

Defined in:
lib/dandy/routing/syntax/node.rb

#parse(parent_node = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dandy/routing/syntax/node.rb', line 5

def parse(parent_node = nil)
  @parent_node = parent_node

  elements.each do |element|
    if element.is_a? Indent
      @level = element.elements.length
    end

    if element.is_a? Route
      @route = element.parse(self)
    end

    if element.is_a? Actions
      @actions = element.parse(self)
    end

    if element.is_a? Nodes
      @my_nodes = element.parse(self)
    end

    if element.is_a? BeforeSection
      @before_commands = element.parse.commands
    end

    if element.is_a? AfterSection
      @after_commands = element.parse.commands
    end
  end

  self
end