Class: ActiveRecord::Refined::AST::JsonLiteral

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

Overview

A Ruby value on the JSON side of a comparison, which jsonb and MySQL's JSON type answer alike: numbers compare as numbers and documents structurally. SQLite and MariaDB have only the text of each -- spelling and key order deciding what equality means -- and refuse here. PostgreSQL needs no cast, an untyped literal beside a jsonb operand coercing to jsonb; MySQL is told CAST(... AS JSON), since a bare string beside JSON would be a JSON string, and every string outranks every number in its ordering.

Instance Method Summary collapse

Methods inherited from Node

#as, #asc, #collate, #desc

Constructor Details

#initialize(value) ⇒ JsonLiteral

Returns a new instance of JsonLiteral.



1091
1092
1093
# File 'lib/active_record/refined/ast.rb', line 1091

def initialize(value)
  @value = value
end