Class: ActiveRecord::Refined::AST::TruthValue

Inherits:
Predicate show all
Defined in:
lib/active_record/refined/ast.rb

Overview

IS TRUE, IS FALSE and their negations, which every adapter spells the same way and answers alike, NULL included.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Predicate

#!, #&, #|

Methods inherited from Node

#as, #asc, #collate, #desc

Constructor Details

#initialize(operand, value, negated: false) ⇒ TruthValue

Returns a new instance of TruthValue.



2059
2060
2061
2062
2063
# File 'lib/active_record/refined/ast.rb', line 2059

def initialize(operand, value, negated: false)
  @operand = operand
  @value = value
  @negated = negated
end

Instance Attribute Details

#negatedObject (readonly)

Returns the value of attribute negated.



2057
2058
2059
# File 'lib/active_record/refined/ast.rb', line 2057

def negated
  @negated
end

#operandObject (readonly)

Returns the value of attribute operand.



2057
2058
2059
# File 'lib/active_record/refined/ast.rb', line 2057

def operand
  @operand
end

#valueObject (readonly)

Returns the value of attribute value.



2057
2058
2059
# File 'lib/active_record/refined/ast.rb', line 2057

def value
  @value
end

Instance Method Details

#to_arel(table, model) ⇒ Object



2065
2066
2067
2068
# File 'lib/active_record/refined/ast.rb', line 2065

def to_arel(table, model)
  Dialect.for(model).truth_value(
    to_arel_operand(operand, table, model), value, negated, model)
end