Class: ActiveRecord::Refined::AST::BitwiseNot

Inherits:
Node
  • Object
show all
Includes:
Arithmetics, BitwiseOperands, Predications
Defined in:
lib/active_record/refined/ast.rb

Overview

~, which every adapter has. MySQL answers with the unsigned 64-bit number where the others answer with a negative one; the bits are the same, and only reading the value back tells them apart.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Arithmetics

#&, #*, #+, #-, #/, #<<, #>>, #^, #|, #~

Methods included from Predications

#!=, #!~, #<, #<=, #==, #=~, #>, #>=, #between?, #bury, #casecmp?, #contains?, #dig, #dig_json, #distinct_from?, #end_with?, #false?, #ilike?, #in?, #include?, #intersect?, #key?, #like?, #member?, #not_between?, #not_distinct_from?, #not_false?, #not_ilike?, #not_in?, #not_like?, #not_null?, #not_true?, #null?, #start_with?, #subset?, #superset?, #true?, #when

Methods inherited from Node

#as, #asc, #desc

Constructor Details

#initialize(operand) ⇒ BitwiseNot

Returns a new instance of BitwiseNot.



807
808
809
# File 'lib/active_record/refined/ast.rb', line 807

def initialize(operand)
  @operand = check_operand(operand, :~)
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



805
806
807
# File 'lib/active_record/refined/ast.rb', line 805

def operand
  @operand
end

Instance Method Details

#to_arel(table, model) ⇒ Object



811
812
813
814
815
# File 'lib/active_record/refined/ast.rb', line 811

def to_arel(table, model)
  check_not_boolean(operand, :~, model)
  Arel::Nodes::Grouping.new(
    Arel::Nodes::BitwiseNot.new(to_arel_operand(operand, table, model)))
end