activerecord-postgres-earthdistance 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba84eef72063d43d8409981a0de2169081953159
4
- data.tar.gz: 8d9775c25f7dbafe1df807816c9e1e72dca92718
3
+ metadata.gz: 46d72052be04de8547bb77665bcf6d489db976aa
4
+ data.tar.gz: 55a3171e669113183f6a48eb283a407c18e43221
5
5
  SHA512:
6
- metadata.gz: ef50f5bba44fa8612cb55f3837dedb9fd1a66990d6a44fbfe000aafebb341d5b98899c54f739af4dbcec95b7b29ee27b60a2797b95d215b2061d5383124e8622
7
- data.tar.gz: 84f152880d57a62d38aff7ec1d1f04b45882b3019deb74abb2e4381a2940a110a61cfd61c4315bcc5cfce26696ff825367acec64bdd88a96ff3e53f73a7bbd55
6
+ metadata.gz: 98d50f7ed42fd9c3565214e1d610d3eff809b482039c0be4ae12c05b0a6e764c2ae26a28d97302d58055c31f200e807ff49b6c02660a9c9f3b4f6ec553fc2ab5
7
+ data.tar.gz: e0752d90060076c92e23a5c40768260840d085755fe25c7d19656aa21289c1d1d4560adfd9b7984eb6f2da66e2008c74cb6ff136977d935ed72e5b74edf19efe
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-postgres-earthdistance (0.4.1)
4
+ activerecord-postgres-earthdistance (0.4.2)
5
5
  pg
6
6
  rails (>= 3.1)
7
7
  rake
@@ -9,36 +9,36 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- actionmailer (4.2.1)
13
- actionpack (= 4.2.1)
14
- actionview (= 4.2.1)
15
- activejob (= 4.2.1)
12
+ actionmailer (4.2.2)
13
+ actionpack (= 4.2.2)
14
+ actionview (= 4.2.2)
15
+ activejob (= 4.2.2)
16
16
  mail (~> 2.5, >= 2.5.4)
17
17
  rails-dom-testing (~> 1.0, >= 1.0.5)
18
- actionpack (4.2.1)
19
- actionview (= 4.2.1)
20
- activesupport (= 4.2.1)
18
+ actionpack (4.2.2)
19
+ actionview (= 4.2.2)
20
+ activesupport (= 4.2.2)
21
21
  rack (~> 1.6)
22
22
  rack-test (~> 0.6.2)
23
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
24
24
  rails-html-sanitizer (~> 1.0, >= 1.0.1)
25
- actionview (4.2.1)
26
- activesupport (= 4.2.1)
25
+ actionview (4.2.2)
26
+ activesupport (= 4.2.2)
27
27
  builder (~> 3.1)
28
28
  erubis (~> 2.7.0)
29
29
  rails-dom-testing (~> 1.0, >= 1.0.5)
30
30
  rails-html-sanitizer (~> 1.0, >= 1.0.1)
31
- activejob (4.2.1)
32
- activesupport (= 4.2.1)
31
+ activejob (4.2.2)
32
+ activesupport (= 4.2.2)
33
33
  globalid (>= 0.3.0)
34
- activemodel (4.2.1)
35
- activesupport (= 4.2.1)
34
+ activemodel (4.2.2)
35
+ activesupport (= 4.2.2)
36
36
  builder (~> 3.1)
37
- activerecord (4.2.1)
38
- activemodel (= 4.2.1)
39
- activesupport (= 4.2.1)
37
+ activerecord (4.2.2)
38
+ activemodel (= 4.2.2)
39
+ activesupport (= 4.2.2)
40
40
  arel (~> 6.0)
41
- activesupport (4.2.1)
41
+ activesupport (4.2.2)
42
42
  i18n (~> 0.7)
43
43
  json (~> 1.7, >= 1.7.7)
44
44
  minitest (~> 5.1)
@@ -51,7 +51,7 @@ GEM
51
51
  globalid (0.3.5)
52
52
  activesupport (>= 4.1.0)
53
53
  i18n (0.7.0)
54
- json (1.8.1)
54
+ json (1.8.3)
55
55
  loofah (2.0.2)
56
56
  nokogiri (>= 1.5.9)
57
57
  mail (2.6.3)
@@ -62,19 +62,19 @@ GEM
62
62
  nokogiri (1.6.6.2)
63
63
  mini_portile (~> 0.6.0)
64
64
  pg (0.18.2)
65
- rack (1.6.1)
65
+ rack (1.6.2)
66
66
  rack-test (0.6.3)
67
67
  rack (>= 1.0)
68
- rails (4.2.1)
69
- actionmailer (= 4.2.1)
70
- actionpack (= 4.2.1)
71
- actionview (= 4.2.1)
72
- activejob (= 4.2.1)
73
- activemodel (= 4.2.1)
74
- activerecord (= 4.2.1)
75
- activesupport (= 4.2.1)
68
+ rails (4.2.2)
69
+ actionmailer (= 4.2.2)
70
+ actionpack (= 4.2.2)
71
+ actionview (= 4.2.2)
72
+ activejob (= 4.2.2)
73
+ activemodel (= 4.2.2)
74
+ activerecord (= 4.2.2)
75
+ activesupport (= 4.2.2)
76
76
  bundler (>= 1.3.0, < 2.0)
77
- railties (= 4.2.1)
77
+ railties (= 4.2.2)
78
78
  sprockets-rails
79
79
  rails-deprecated_sanitizer (1.0.3)
80
80
  activesupport (>= 4.2.0.alpha)
@@ -84,14 +84,13 @@ GEM
84
84
  rails-deprecated_sanitizer (>= 1.0.1)
85
85
  rails-html-sanitizer (1.0.2)
86
86
  loofah (~> 2.0)
87
- railties (4.2.1)
88
- actionpack (= 4.2.1)
89
- activesupport (= 4.2.1)
87
+ railties (4.2.2)
88
+ actionpack (= 4.2.2)
89
+ activesupport (= 4.2.2)
90
90
  rake (>= 0.8.7)
91
91
  thor (>= 0.18.1, < 2.0)
92
92
  rake (10.4.2)
93
93
  rdoc (4.2.0)
94
- json (~> 1.4)
95
94
  rspec (2.99.0)
96
95
  rspec-core (~> 2.99.0)
97
96
  rspec-expectations (~> 2.99.0)
@@ -99,8 +98,8 @@ GEM
99
98
  rspec-core (2.99.2)
100
99
  rspec-expectations (2.99.2)
101
100
  diff-lcs (>= 1.1.3, < 2.0)
102
- rspec-mocks (2.99.2)
103
- sprockets (3.1.0)
101
+ rspec-mocks (2.99.3)
102
+ sprockets (3.2.0)
104
103
  rack (~> 1.0)
105
104
  sprockets-rails (2.3.1)
106
105
  actionpack (>= 3.0)
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "activerecord-postgres-earthdistance"
7
- s.version = "0.4.1"
7
+ s.version = "0.4.2"
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.license = "MIT"
@@ -12,13 +12,13 @@ module ActiveRecordPostgresEarthdistance
12
12
  end
13
13
 
14
14
  def within_box(radius, lat, lng)
15
- earth_box = Arel::Nodes::NamedFunction.new('earth_box', [ll_to_earth_coords(lat, lng), radius])
15
+ earth_box = Arel::Nodes::NamedFunction.new('earth_box', [ll_to_earth_coords(lat, lng), quote_value(radius)])
16
16
  where Arel::Nodes::InfixOperation.new('<@', ll_to_earth_columns, earth_box)
17
17
  end
18
18
 
19
19
  def within_radius(radius, lat, lng)
20
20
  earth_distance = Arel::Nodes::NamedFunction.new('earth_distance', [ll_to_earth_columns, ll_to_earth_coords(lat, lng)])
21
- within_box(radius, lat, lng).where(Arel::Nodes::InfixOperation.new('<=', earth_distance, radius))
21
+ within_box(radius, lat, lng).where(Arel::Nodes::InfixOperation.new('<=', earth_distance, quote_value(radius)))
22
22
  end
23
23
 
24
24
  def order_by_distance(lat, lng, order = "ASC")
@@ -32,10 +32,14 @@ module ActiveRecordPostgresEarthdistance
32
32
  end
33
33
 
34
34
  def ll_to_earth_coords lat, lng
35
+ Arel::Nodes::NamedFunction.new('ll_to_earth', [quote_value(lat), quote_value(lng)])
36
+ end
37
+
38
+ def quote_value value
35
39
  if Arel::Nodes.respond_to?(:build_quoted) # for arel >= 6.0.0
36
- Arel::Nodes::NamedFunction.new('ll_to_earth', [Arel::Nodes.build_quoted(lat), Arel::Nodes.build_quoted(lng)])
40
+ Arel::Nodes.build_quoted(value)
37
41
  else
38
- Arel::Nodes::NamedFunction.new('ll_to_earth', [lat, lng])
42
+ value
39
43
  end
40
44
  end
41
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-earthdistance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Biazus