Class: Yap::Shell::Parser::Nodes::ConditionalNode

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/yap/shell/parser/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Visitor

#accept

Constructor Details

#initialize(token, expr1, expr2) ⇒ ConditionalNode

Returns a new instance of ConditionalNode.



167
168
169
170
171
# File 'lib/yap/shell/parser/nodes.rb', line 167

def initialize(token, expr1, expr2)
  @operator = token.value
  @expr1    = expr1
  @expr2    = expr2
end

Instance Attribute Details

#expr1Object (readonly)

Returns the value of attribute expr1.



165
166
167
# File 'lib/yap/shell/parser/nodes.rb', line 165

def expr1
  @expr1
end

#expr2Object (readonly)

Returns the value of attribute expr2.



165
166
167
# File 'lib/yap/shell/parser/nodes.rb', line 165

def expr2
  @expr2
end

#operatorObject (readonly)

Returns the value of attribute operator.



165
166
167
# File 'lib/yap/shell/parser/nodes.rb', line 165

def operator
  @operator
end

Instance Method Details

#to_sObject



173
174
175
# File 'lib/yap/shell/parser/nodes.rb', line 173

def to_s
  "ConditionalNode(#{@operator}, #{@expr1}, #{@expr2.to_s})"
end