Class: ActiveRecord::Refined::AST::JsonHasKey
- Defined in:
- lib/active_record/refined/ast.rb
Overview
Whether a key is in the document. PostgreSQL's spelling is the ? operator rather than jsonb_exists, the function it is shorthand for, because a GIN index matches the operator and never the function. A ? is a bind placeholder only to sanitize_sql, which none of the SQL written here passes through.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
Instance Method Summary collapse
-
#initialize(operand, key) ⇒ JsonHasKey
constructor
A new instance of JsonHasKey.
- #to_arel(table, model) ⇒ Object
Methods inherited from Predicate
Methods inherited from Node
Constructor Details
#initialize(operand, key) ⇒ JsonHasKey
Returns a new instance of JsonHasKey.
1138 1139 1140 1141 |
# File 'lib/active_record/refined/ast.rb', line 1138 def initialize(operand, key) @operand = operand @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
1136 1137 1138 |
# File 'lib/active_record/refined/ast.rb', line 1136 def key @key end |
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
1136 1137 1138 |
# File 'lib/active_record/refined/ast.rb', line 1136 def operand @operand end |