Class: Estreet::SwitchCase
Instance Attribute Summary
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(test, consequent) ⇒ SwitchCase
constructor
A new instance of SwitchCase.
Methods inherited from Node
Constructor Details
#initialize(test, consequent) ⇒ SwitchCase
Returns a new instance of SwitchCase.
28 29 30 31 |
# File 'lib/estreet/switch_statement.rb', line 28 def initialize(test, consequent) @test = test.to_expression if test @consequent = Array(consequent).map {|c| c.to_statement } end |
Class Method Details
.default(consequent) ⇒ Object
33 34 35 |
# File 'lib/estreet/switch_statement.rb', line 33 def self.default(consequent) self.new(nil, consequent) end |
Instance Method Details
#attributes ⇒ Object
37 38 39 |
# File 'lib/estreet/switch_statement.rb', line 37 def attributes super.merge(test: @test, consequent: @consequent) end |