Class: Foxtail::Syntax::Parser::AST::Variant

Inherits:
SyntaxNode show all
Defined in:
lib/foxtail/syntax/parser/ast/variant.rb

Overview

Represents individual variants within select expressions

Instance Attribute Summary collapse

Attributes inherited from SyntaxNode

#span

Attributes inherited from BaseNode

#type

Instance Method Summary collapse

Methods inherited from SyntaxNode

#add_span

Methods inherited from BaseNode

#==, #accept, #to_h

Constructor Details

#initialize(key, value, default: false) ⇒ Variant

Returns a new instance of Variant.



13
14
15
16
17
18
# File 'lib/foxtail/syntax/parser/ast/variant.rb', line 13

def initialize(key, value, default: false)
  super()
  @key = key
  @value = value
  @default = default
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



11
12
13
# File 'lib/foxtail/syntax/parser/ast/variant.rb', line 11

def default
  @default
end

#keyObject

Returns the value of attribute key.



9
10
11
# File 'lib/foxtail/syntax/parser/ast/variant.rb', line 9

def key
  @key
end

#valueObject

Returns the value of attribute value.



10
11
12
# File 'lib/foxtail/syntax/parser/ast/variant.rb', line 10

def value
  @value
end

Instance Method Details

#childrenObject



20
# File 'lib/foxtail/syntax/parser/ast/variant.rb', line 20

def children = [key, value]