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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(else_parsed) ⇒ Else

Returns a new instance of Else.



8
9
10
11
12
13
14
15
16
# File 'lib/code/node/if.rb', line 8

def initialize(else_parsed)
  if else_parsed.key?(:operator)
    @operator = else_parsed.fetch(:operator)
    @statement =
      ::Code::Node::Statement.new(else_parsed.fetch(:statement))
  end

  @body = ::Code::Node::Code.new(else_parsed.fetch(:body))
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#operatorObject (readonly)

Returns the value of attribute operator.



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

def operator
  @operator
end

#statementObject (readonly)

Returns the value of attribute statement.



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

def statement
  @statement
end