Class: Code::Node::If::Else

Inherits:
Code::Node show all
Defined in:
lib/code/node/if.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Code::Node

#evaluate

Constructor Details

#initialize(parsed) ⇒ Else

Returns a new instance of Else.



12
13
14
15
16
17
18
19
# File 'lib/code/node/if.rb', line 12

def initialize(parsed)
  @operator = parsed.delete(:operator)
  @body = Node::Code.new(parsed.delete(:body))

  if parsed.key?(:statement)
    @statement = Node::Statement.new(parsed.delete(:statement))
  end
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/code/node/if.rb', line 10

def body
  @body
end

#operatorObject (readonly)

Returns the value of attribute operator.



10
11
12
# File 'lib/code/node/if.rb', line 10

def operator
  @operator
end

#statementObject (readonly)

Returns the value of attribute statement.



10
11
12
# File 'lib/code/node/if.rb', line 10

def statement
  @statement
end