Class: AttrJson::Record::QueryBuilder
- Inherits:
-
Object
- Object
- AttrJson::Record::QueryBuilder
- Defined in:
- lib/attr_json/record/query_builder.rb
Overview
Implementation class called by #jsonb_contains scope method. Ordinarily you don't need to use it yourself, but you can.
Instance Attribute Summary collapse
-
#input_attributes ⇒ Object
readonly
Returns the value of attribute input_attributes.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
- #contains_not_relation ⇒ Object
- #contains_relation ⇒ Object
-
#initialize(relation, input_attributes) ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
Constructor Details
#initialize(relation, input_attributes) ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
9 10 11 12 |
# File 'lib/attr_json/record/query_builder.rb', line 9 def initialize(relation, input_attributes) @relation = relation @input_attributes = input_attributes end |
Instance Attribute Details
#input_attributes ⇒ Object (readonly)
Returns the value of attribute input_attributes.
8 9 10 |
# File 'lib/attr_json/record/query_builder.rb', line 8 def input_attributes @input_attributes end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
8 9 10 |
# File 'lib/attr_json/record/query_builder.rb', line 8 def relation @relation end |
Instance Method Details
#contains_not_relation ⇒ Object
20 21 22 23 24 |
# File 'lib/attr_json/record/query_builder.rb', line 20 def contains_not_relation contains_relation_impl do |relation, query, params| relation.where.not(query, params) end end |
#contains_relation ⇒ Object
14 15 16 17 18 |
# File 'lib/attr_json/record/query_builder.rb', line 14 def contains_relation contains_relation_impl do |relation, query, params| relation.where(query, params) end end |