Class: DrgDSL::Ast::TableCondition
- Inherits:
-
Object
- Object
- DrgDSL::Ast::TableCondition
- Includes:
- Node
- Defined in:
- lib/drgdsl/ast.rb
Overview
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)
Constant Summary collapse
- IN_TABLE =
'in table'
- IN_TABLES =
'in tables'
- ALL_IN_TABLE =
'all in table'
Instance Attribute Summary collapse
-
#comparison ⇒ Object
readonly
Returns the value of attribute comparison.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(op:, tables:, comparison: nil) ⇒ TableCondition
constructor
A new instance of TableCondition.
- #to_hash ⇒ Object
Methods included from Node
#==, #accept, included, #mdc_equality?, node_classes, #pretty_print, #sep_equality?, type, #type
Constructor Details
#initialize(op:, tables:, comparison: nil) ⇒ TableCondition
Returns a new instance of TableCondition.
323 324 325 326 327 |
# File 'lib/drgdsl/ast.rb', line 323 def initialize(op:, tables:, comparison: nil) @op = op @tables = Array(tables).map(&:to_s) @comparison = comparison end |
Instance Attribute Details
#comparison ⇒ Object (readonly)
Returns the value of attribute comparison.
319 320 321 |
# File 'lib/drgdsl/ast.rb', line 319 def comparison @comparison end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
319 320 321 |
# File 'lib/drgdsl/ast.rb', line 319 def op @op end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
319 320 321 |
# File 'lib/drgdsl/ast.rb', line 319 def tables @tables end |
Instance Method Details
#hash ⇒ Object
339 340 341 |
# File 'lib/drgdsl/ast.rb', line 339 def hash @hash ||= [type, op, *tables, comparison].hash end |
#to_hash ⇒ Object
329 330 331 332 333 334 335 336 337 |
# File 'lib/drgdsl/ast.rb', line 329 def to_hash { table_condition: { op: op, tables: tables, comparison: comparison&.to_hash } } end |