Class: ActiveRecord::Refined::AST::JsonLiteral
- 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 Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ JsonLiteral
constructor
A new instance of JsonLiteral.
- #to_arel(_table, model) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(value) ⇒ JsonLiteral
Returns a new instance of JsonLiteral.
959 960 961 |
# File 'lib/active_record/refined/ast.rb', line 959 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
957 958 959 |
# File 'lib/active_record/refined/ast.rb', line 957 def value @value end |