class DDQL::TokenType::Query

Public Class Methods

new() click to toggle source
Calls superclass method DDQL::TokenType::new
# File lib/ddql/token_type.rb, line 371
def initialize
  super(name: :query, pattern: /(?<=\{)(?<subquery>[^{}]+)(?=\{|\})/)
end

Public Instance Methods

as_hash(data) click to toggle source
# File lib/ddql/token_type.rb, line 375
def as_hash(data)
  _initialize if @sub_query_pattern.nil?
  tokens = Lexer.lex(data, pattern: @sub_query_pattern, available_types: @parts)
  {agg: {op_is: 'IS'}, right: {null_value_type: data.split(' ').last}}
end
expression?() click to toggle source
# File lib/ddql/token_type.rb, line 381
def expression?
  true
end

Private Instance Methods

_initialize() click to toggle source
# File lib/ddql/token_type.rb, line 386
def _initialize
  @sub_query_fields     = SubQueryFields.new
  @sub_query_type       = SubQueryType.new
  @sub_query_expression = SubQueryExpression.new
  @parts                = [@sub_query_fields, @sub_query_type, @sub_query_expression]
  @sub_query_pattern    = Regexp.compile(@parts.map do |tt|
    "(?<#{tt.name}>#{tt.pattern})"
  end.join('|'))
end