Class: SQLTree::Token
- Inherits:
-
Object
- Object
- SQLTree::Token
- Defined in:
- lib/sql_tree/token.rb
Defined Under Namespace
Classes: Keyword, Number, Operator, String, Value, Variable
Constant Summary collapse
- LPAREN =
Class.new(SQLTree::Token).new('(')
- RPAREN =
Class.new(SQLTree::Token).new(')')
- DOT =
Class.new(SQLTree::Token).new('.')
- COMMA =
Class.new(SQLTree::Token).new(',')
- KEYWORDS =
%w{select from where group having order distinct left right inner outer join and or not as}
- ARITHMETHIC_OPERATORS =
{ '+' => :plus, '-' => :minus, '*' => :multiply, '/' => :divide, '%' => :modulo }
- LOGICAL_OPERATORS =
{ '=' => :eq, '!=' => :ne, '<>' => :ne, '>' => :gt, '<' => :lt, '>=' => :gte, '<=' => :lte }
- OPERATORS =
ARITHMETHIC_OPERATORS.merge(LOGICAL_OPERATORS)
Instance Attribute Summary collapse
-
#literal ⇒ Object
Returns the value of attribute literal.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(literal) ⇒ Token
constructor
A new instance of Token.
- #inspect ⇒ Object
Constructor Details
#initialize(literal) ⇒ Token
Returns a new instance of Token.
5 6 7 |
# File 'lib/sql_tree/token.rb', line 5 def initialize(literal) @literal = literal end |
Instance Attribute Details
#literal ⇒ Object
Returns the value of attribute literal.
3 4 5 |
# File 'lib/sql_tree/token.rb', line 3 def literal @literal end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
9 10 11 |
# File 'lib/sql_tree/token.rb', line 9 def ==(other) other.class == self.class && @literal == other.literal end |
#inspect ⇒ Object
15 16 17 |
# File 'lib/sql_tree/token.rb', line 15 def inspect literal end |