Class: ActiveRecord::QueryMethods::WhereChain

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-postgis-array/active_record/relation/query_methods.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ WhereChain

Returns a new instance of WhereChain.



6
7
8
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 6

def initialize(scope)
  @scope = scope
end

Instance Method Details

#all(opts) ⇒ Object



53
54
55
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 53

def all(opts)
  equality_to_function('ALL', opts)
end

#any(opts) ⇒ Object



49
50
51
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 49

def any(opts)
  equality_to_function('ANY', opts)
end

#contained_within(opts) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 17

def contained_within(opts)
  opts.each do |key, value|
    @scope = @scope.where(arel_table[key].contained_within(value))
  end

  @scope
end

#contained_within_or_equals(opts) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 25

def contained_within_or_equals(opts)
  opts.each do |key, value|
    @scope = @scope.where(arel_table[key].contained_within_or_equals(value))
  end

  @scope
end

#contains(opts) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 33

def contains(opts)
  opts.each do |key, value|
    @scope = @scope.where(arel_table[key].contains(value))
  end

  @scope
end

#contains_or_equals(opts) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 41

def contains_or_equals(opts)
  opts.each do |key, value|
    @scope = @scope.where(arel_table[key].contains_or_equals(value))
  end

  @scope
end

#overlap(opts) ⇒ Object



10
11
12
13
14
15
# File 'lib/activerecord-postgis-array/active_record/relation/query_methods.rb', line 10

def overlap(opts)
  opts.each do |key, value|
    @scope = @scope.where(arel_table[key].overlap(value))
  end
  @scope
end