Class: ActiveRecord::Refined::AST::Cast

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

Overview

CAST(expr AS type). The type is grammar too, written into the SQL as given -- it is the adapter's own name for the type, and whether it exists is the database's to say -- so it has to look like one: a plain name, at most parenthesized with lengths.

Instance Method Summary collapse

Methods included from Arithmetics

#&, #*, #+, #-, #/, #<<, #>>, #^, #bitwise_and, #bitwise_not, #bitwise_or, #bitwise_xor, #|, #~

Methods included from Predications

#!=, #!~, #<, #<=, #==, #=~, #>, #>=, #between?, #bury, #casecmp?, #contains?, #dig, #dig_text, #distinct_from?, #end_with?, #except, #false?, #ilike?, #in?, #include?, #intersect?, #key?, #keys, #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, #collate, #desc

Constructor Details

#initialize(operand, sql_type) ⇒ Cast

Returns a new instance of Cast.



2197
2198
2199
2200
# File 'lib/active_record/refined/ast.rb', line 2197

def initialize(operand, sql_type)
  @operand = operand
  @sql_type = AST.check_name(sql_type, TYPE_NAME, "SQL type")
end