Class: Baba::Stmt::If
- Inherits:
-
Object
- Object
- Baba::Stmt::If
- Defined in:
- lib/baba/stmt.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#else_branch ⇒ Object
readonly
Returns the value of attribute else_branch.
-
#then_branch ⇒ Object
readonly
Returns the value of attribute then_branch.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(condition, then_branch, else_branch) ⇒ If
constructor
A new instance of If.
Constructor Details
#initialize(condition, then_branch, else_branch) ⇒ If
Returns a new instance of If.
54 55 56 |
# File 'lib/baba/stmt.rb', line 54 def initialize(condition, then_branch, else_branch) @condition = condition; @then_branch = then_branch; @else_branch = else_branch end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
52 53 54 |
# File 'lib/baba/stmt.rb', line 52 def condition @condition end |
#else_branch ⇒ Object (readonly)
Returns the value of attribute else_branch.
52 53 54 |
# File 'lib/baba/stmt.rb', line 52 def else_branch @else_branch end |
#then_branch ⇒ Object (readonly)
Returns the value of attribute then_branch.
52 53 54 |
# File 'lib/baba/stmt.rb', line 52 def then_branch @then_branch end |
Instance Method Details
#accept(visitor) ⇒ Object
58 59 60 |
# File 'lib/baba/stmt.rb', line 58 def accept(visitor) visitor.visit_if_stmt(self) end |