Class: Zaid::Nodes::WhileNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/zaid/nodes/while_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



5
6
7
# File 'lib/zaid/nodes/while_node.rb', line 5

def body
  @body
end

#conditionObject

Returns the value of attribute condition

Returns:

  • (Object)

    the current value of condition



5
6
7
# File 'lib/zaid/nodes/while_node.rb', line 5

def condition
  @condition
end

Instance Method Details

#eval(context) ⇒ Object



6
7
8
9
10
# File 'lib/zaid/nodes/while_node.rb', line 6

def eval(context)
  body.eval(context) while condition.eval(context).ruby_value

  Constants['مجهول']
end