class DrgDSL::Ast::TableCondition

There are 3 variants of table conditions (in_table, in_tables, all_in_table)

A table condition can have an optional comparison. Tables refers to the table names (the internal names)

Constants

ALL_IN_TABLE
IN_TABLE
IN_TABLES

Attributes

comparison[R]
op[R]
tables[R]

Public Class Methods

new(op:, tables:, comparison: nil) click to toggle source

@param op [String] IN_TABLE, IN_TABLES or ALL_IN_TABLE @param tables [Array<String>] one or more table names

# File lib/drgdsl/ast.rb, line 323
def initialize(op:, tables:, comparison: nil)
  @op = op
  @tables = Array(tables).map(&:to_s)
  @comparison = comparison
end

Public Instance Methods

hash() click to toggle source
# File lib/drgdsl/ast.rb, line 339
def hash
  @hash ||= [type, op, *tables, comparison].hash
end
to_hash() click to toggle source
# File lib/drgdsl/ast.rb, line 329
def to_hash
  {
    table_condition: {
      op: op,
      tables: tables,
      comparison: comparison&.to_hash
    }
  }
end