Class: ActiveRecord::Refined::AST::JsonKeys
- 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 Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
Instance Method Summary collapse
-
#initialize(operand) ⇒ JsonKeys
constructor
A new instance of JsonKeys.
- #to_arel(table, model) ⇒ Object
Methods included from ComputedJson
Methods included from JsonComparable
#between?, #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
Constructor Details
#initialize(operand) ⇒ JsonKeys
Returns a new instance of JsonKeys.
1165 1166 1167 |
# File 'lib/active_record/refined/ast.rb', line 1165 def initialize(operand) @operand = operand end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
1163 1164 1165 |
# File 'lib/active_record/refined/ast.rb', line 1163 def operand @operand end |