Class: DrgDSL::Ast::Comparison
- Inherits:
-
Object
- Object
- DrgDSL::Ast::Comparison
- Includes:
- Node
- Defined in:
- lib/drgdsl/ast.rb
Overview
A comparison is either from a table_condition, a condition or a date_expression
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#table_condition ⇒ Object
readonly
Returns the value of attribute table_condition.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(op:, value:, table_condition: nil) ⇒ Comparison
constructor
A new instance of Comparison.
- #to_hash ⇒ Object
Methods included from Node
#==, #accept, included, #mdc_equality?, node_classes, #pretty_print, #sep_equality?, type, #type
Constructor Details
#initialize(op:, value:, table_condition: nil) ⇒ Comparison
Returns a new instance of Comparison.
246 247 248 249 250 |
# File 'lib/drgdsl/ast.rb', line 246 def initialize(op:, value:, table_condition: nil) @op = op.to_s.strip @value = value @table_condition = table_condition end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
244 245 246 |
# File 'lib/drgdsl/ast.rb', line 244 def op @op end |
#table_condition ⇒ Object (readonly)
Returns the value of attribute table_condition.
244 245 246 |
# File 'lib/drgdsl/ast.rb', line 244 def table_condition @table_condition end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
244 245 246 |
# File 'lib/drgdsl/ast.rb', line 244 def value @value end |
Instance Method Details
#hash ⇒ Object
262 263 264 |
# File 'lib/drgdsl/ast.rb', line 262 def hash @hash ||= [type, op, value, table_condition].hash end |
#to_hash ⇒ Object
252 253 254 255 256 257 258 259 260 |
# File 'lib/drgdsl/ast.rb', line 252 def to_hash { comparison: { op: op, value: value.to_hash, table_condition: table_condition&.to_hash } } end |