Class: Melbourne::AST::Case
- Defined in:
- lib/melbourne/ast/control_flow.rb
Overview
A case statement as in
case
when a == 1 then
# something
when a == 2
# something
end
Direct Known Subclasses
Instance Attribute Summary collapse
-
#else ⇒ Object
The
elsenode of thecasestatement (ornilif there is none). -
#whens ⇒ Object
The
whennodes of thecasestatement.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, whens, else_body) ⇒ Case
constructor
A new instance of Case.
Methods inherited from Node
Constructor Details
#initialize(line, whens, else_body) ⇒ Case
Returns a new instance of Case.
24 25 26 27 28 |
# File 'lib/melbourne/ast/control_flow.rb', line 24 def initialize(line, whens, else_body) @line = line @whens = whens @else = else_body || Nil.new(line) end |
Instance Attribute Details
#else ⇒ Object
The else node of the case statement (or nil if there is none)
22 23 24 |
# File 'lib/melbourne/ast/control_flow.rb', line 22 def else @else end |
#whens ⇒ Object
The when nodes of the case statement
18 19 20 |
# File 'lib/melbourne/ast/control_flow.rb', line 18 def whens @whens end |