Class: Kumi::Core::NAST::Select

Inherits:
Node
  • Object
show all
Defined in:
lib/kumi/core/nast.rb

Overview

Control: ternary select (pure, eager)

Instance Attribute Summary collapse

Attributes inherited from Node

#id, #loc, #meta

Instance Method Summary collapse

Constructor Details

#initialize(cond:, on_true:, on_false:, **k) ⇒ Select

Returns a new instance of Select.



164
165
166
167
168
169
# File 'lib/kumi/core/nast.rb', line 164

def initialize(cond:, on_true:, on_false:, **k)
  super(**k)
  @cond = cond
  @on_true = on_true
  @on_false = on_false
end

Instance Attribute Details

#condObject (readonly)

Returns the value of attribute cond.



162
163
164
# File 'lib/kumi/core/nast.rb', line 162

def cond
  @cond
end

#on_falseObject (readonly)

Returns the value of attribute on_false.



162
163
164
# File 'lib/kumi/core/nast.rb', line 162

def on_false
  @on_false
end

#on_trueObject (readonly)

Returns the value of attribute on_true.



162
163
164
# File 'lib/kumi/core/nast.rb', line 162

def on_true
  @on_true
end

Instance Method Details

#accept(visitor) ⇒ Object



171
172
173
# File 'lib/kumi/core/nast.rb', line 171

def accept(visitor)
  visitor.respond_to?(:visit_select) ? visitor.visit_select(self) : super
end