Class: AttrJson::Record::QueryBuilder

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_attributesObject (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

#relationObject (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_relationObject



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_relationObject



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