Class: ActiveRecord::Refined::AST::JsonKeys

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

Overview

The keys of a JSON document, as Hash#keys gives them: a JSON array. Only the MySQL family has a function for it; the other two reach the same array through a subquery over their key-listing functions. The type guard is what makes all four answer alike: the keys of what is not an object are NULL rather than SQLite's array indices or PostgreSQL's error, and the keys of {} are [] rather than PostgreSQL's NULL, jsonb_agg over no rows.

Instance Method Summary collapse

Methods included from JsonComparable

#between?, #bitwise_not, #in?, #not_between?, #not_in?, #~

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) ⇒ JsonKeys

Returns a new instance of JsonKeys.



1323
1324
1325
# File 'lib/active_record/refined/ast.rb', line 1323

def initialize(operand)
  @operand = operand
end