Class: SQLTree::Token::Value

Inherits:
SQLTree::Token show all
Defined in:
lib/sql_tree/token.rb

Overview

The SQLTree::Token::Value class is the base class for every dynamic token. A dynamic token is a token for which the literal value used remains impoirtant during parsing.

Direct Known Subclasses

Number, String, Variable

Constant Summary

Constants inherited from SQLTree::Token

ARITHMETHIC_OPERATORS_HASH, COMMA, COMPARISON_OPERATORS, COMPARISON_OPERATORS_HASH, DOT, KEYWORDS, KEYWORD_COMBINATIONS, LPAREN, OPERATORS_HASH, RPAREN

Instance Attribute Summary

Attributes inherited from SQLTree::Token

#literal

Instance Method Summary collapse

Methods inherited from SQLTree::Token

#direction?, #initialize, #join?

Constructor Details

This class inherits a constructor from SQLTree::Token

Instance Method Details

#==(other) ⇒ Object

Compares two tokens. For values, the literal encountered value of the token is also taken into account besides the class.



58
59
60
# File 'lib/sql_tree/token.rb', line 58

def ==(other)
  other.class == self.class && @literal == other.literal
end

#inspectObject

:nodoc:



52
53
54
# File 'lib/sql_tree/token.rb', line 52

def inspect # :nodoc:
  "#<#{self.class.name.split('::').last}:#{literal.inspect}>"
end