Class: TRuby::IR::CaseExpr
Overview
Case/when expression
Instance Attribute Summary collapse
-
#else_clause ⇒ Object
Returns the value of attribute else_clause.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#when_clauses ⇒ Object
Returns the value of attribute when_clauses.
Attributes inherited from Node
#location, #metadata, #type_info
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(subject: nil, when_clauses: [], else_clause: nil, **opts) ⇒ CaseExpr
constructor
A new instance of CaseExpr.
Methods inherited from Node
Constructor Details
#initialize(subject: nil, when_clauses: [], else_clause: nil, **opts) ⇒ CaseExpr
Returns a new instance of CaseExpr.
285 286 287 288 289 290 |
# File 'lib/t_ruby/ir.rb', line 285 def initialize(subject: nil, when_clauses: [], else_clause: nil, **opts) super(**opts) @subject = subject @when_clauses = when_clauses @else_clause = else_clause end |
Instance Attribute Details
#else_clause ⇒ Object
Returns the value of attribute else_clause.
283 284 285 |
# File 'lib/t_ruby/ir.rb', line 283 def else_clause @else_clause end |
#subject ⇒ Object
Returns the value of attribute subject.
283 284 285 |
# File 'lib/t_ruby/ir.rb', line 283 def subject @subject end |
#when_clauses ⇒ Object
Returns the value of attribute when_clauses.
283 284 285 |
# File 'lib/t_ruby/ir.rb', line 283 def when_clauses @when_clauses end |
Instance Method Details
#children ⇒ Object
292 293 294 |
# File 'lib/t_ruby/ir.rb', line 292 def children ([@subject, @else_clause] + @when_clauses).compact end |