Class: DrgDSL::Ast::DateExpression
- Inherits:
-
Object
- Object
- DrgDSL::Ast::DateExpression
- Includes:
- Node
- Defined in:
- lib/drgdsl/ast.rb
Instance Attribute Summary collapse
-
#comparison ⇒ Object
readonly
Returns the value of attribute comparison.
-
#left_condition ⇒ Object
readonly
Returns the value of attribute left_condition.
-
#left_variable ⇒ Object
readonly
Returns the value of attribute left_variable.
-
#opd ⇒ Object
readonly
Returns the value of attribute opd.
-
#right_condition ⇒ Object
readonly
Returns the value of attribute right_condition.
-
#right_variable ⇒ Object
readonly
Returns the value of attribute right_variable.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(left_variable:, right_variable: nil, left_condition:, right_condition: nil, comparison:, opd:) ⇒ DateExpression
constructor
A new instance of DateExpression.
- #to_hash ⇒ Object
Methods included from Node
#==, #accept, included, #mdc_equality?, node_classes, #pretty_print, #sep_equality?, type, #type
Constructor Details
#initialize(left_variable:, right_variable: nil, left_condition:, right_condition: nil, comparison:, opd:) ⇒ DateExpression
Returns a new instance of DateExpression.
380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/drgdsl/ast.rb', line 380 def initialize(left_variable:, right_variable: nil, left_condition:, right_condition: nil, comparison:, opd:) @left_variable = left_variable @right_variable = right_variable @left_condition = left_condition @right_condition = right_condition @comparison = comparison @opd = opd.to_s.strip.upcase end |
Instance Attribute Details
#comparison ⇒ Object (readonly)
Returns the value of attribute comparison.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def comparison @comparison end |
#left_condition ⇒ Object (readonly)
Returns the value of attribute left_condition.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def left_condition @left_condition end |
#left_variable ⇒ Object (readonly)
Returns the value of attribute left_variable.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def left_variable @left_variable end |
#opd ⇒ Object (readonly)
Returns the value of attribute opd.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def opd @opd end |
#right_condition ⇒ Object (readonly)
Returns the value of attribute right_condition.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def right_condition @right_condition end |
#right_variable ⇒ Object (readonly)
Returns the value of attribute right_variable.
372 373 374 |
# File 'lib/drgdsl/ast.rb', line 372 def right_variable @right_variable end |
Instance Method Details
#hash ⇒ Object
408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/drgdsl/ast.rb', line 408 def hash @hash ||= [ type, left_variable, right_variable, left_condition, right_condition, comparison, opd ].hash end |
#to_hash ⇒ Object
395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lib/drgdsl/ast.rb', line 395 def to_hash { opd: { var: opd, left_var: left_variable.to_hash, left_condition: left_condition.to_hash, right_var: right_variable&.to_hash, right_condition: right_condition&.to_hash, comparison: comparison.to_hash } } end |