drifter-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency 'drifter', '0.1.1'
20
+ s.add_dependency 'drifter', '0.1.2'
21
21
  s.add_dependency 'activerecord', '~> 3.0.0'
22
22
 
23
23
  s.add_development_dependency 'mysql'
@@ -1,5 +1,5 @@
1
1
  module Drifter
2
2
  module Rails
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drifter-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ahmed Adam
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-23 00:00:00 +00:00
17
+ date: 2011-01-24 00:00:00 +00:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,11 @@ dependencies:
26
25
  requirements:
27
26
  - - "="
28
27
  - !ruby/object:Gem::Version
29
- hash: 25
30
28
  segments:
31
29
  - 0
32
30
  - 1
33
- - 1
34
- version: 0.1.1
31
+ - 2
32
+ version: 0.1.2
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 7
46
43
  segments:
47
44
  - 3
48
45
  - 0
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 3
62
58
  segments:
63
59
  - 0
64
60
  version: "0"
@@ -72,7 +68,6 @@ dependencies:
72
68
  requirements:
73
69
  - - ">="
74
70
  - !ruby/object:Gem::Version
75
- hash: 3
76
71
  segments:
77
72
  - 0
78
73
  version: "0"
@@ -86,7 +81,6 @@ dependencies:
86
81
  requirements:
87
82
  - - ">="
88
83
  - !ruby/object:Gem::Version
89
- hash: 3
90
84
  segments:
91
85
  - 0
92
86
  version: "0"
@@ -100,7 +94,6 @@ dependencies:
100
94
  requirements:
101
95
  - - ">="
102
96
  - !ruby/object:Gem::Version
103
- hash: 3
104
97
  segments:
105
98
  - 0
106
99
  version: "0"
@@ -117,7 +110,6 @@ extra_rdoc_files: []
117
110
  files:
118
111
  - .gitignore
119
112
  - Gemfile
120
- - README
121
113
  - README.rdoc
122
114
  - Rakefile
123
115
  - drifter-rails.gemspec
@@ -143,7 +135,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
135
  requirements:
144
136
  - - ">="
145
137
  - !ruby/object:Gem::Version
146
- hash: 3
147
138
  segments:
148
139
  - 0
149
140
  version: "0"
@@ -152,14 +143,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
143
  requirements:
153
144
  - - ">="
154
145
  - !ruby/object:Gem::Version
155
- hash: 3
156
146
  segments:
157
147
  - 0
158
148
  version: "0"
159
149
  requirements: []
160
150
 
161
151
  rubyforge_project: drifter-rails
162
- rubygems_version: 1.4.2
152
+ rubygems_version: 1.3.7
163
153
  signing_key:
164
154
  specification_version: 3
165
155
  summary: Distance queries for ActiveRecord 3
data/README DELETED
@@ -1,72 +0,0 @@
1
- == drifter-rails
2
-
3
- drifter-rails is a simple gem that provides distance calculations and queries
4
- for ActiveRecord. It currently supports postgresql and mysql on rails 3.
5
-
6
- === Installation
7
-
8
- # in Gemfile
9
- config.gem 'drifter-rails'
10
-
11
- # optionally, in config/intiailizers/drifter.rb, one of these:
12
- Drifter.default_units = :miles
13
- Drifter.default_units = :km
14
-
15
- # in your model
16
- class Place < ActiveRecord::Base
17
- acts_as_drifter
18
- end
19
-
20
- === Usage
21
-
22
- To return a calculated 'distance' value along with your queries:
23
-
24
- >> origin = [52.123, -2.5432]
25
- >> results = Place.near(origin)
26
- >> results.first.distance
27
- => 12.33228393
28
-
29
- origin can be a two item [lat,lng] array, any acts_as_drifter object or any object that
30
- responds to lat() and lng().
31
-
32
- To return objects within a specific distance of a point of origin:
33
-
34
- >> origin = [52.123, -2.5432]
35
- >> Place.near(origin, :within => 10)
36
- >> Place.near(origin, :within => 10, :units => :km)
37
- => "#<ActiveRecord::Relation:0xafb1e18>"
38
-
39
- The near() method returns an ActiveRecord::Relation that you can use the same as any
40
- other scope, including ordering by distance:
41
-
42
- >> Place.near(origin, :within => 10).includes(:visitors).order("distance ASC")
43
- => "#<ActiveRecord::Relation:0xafb1e18>"
44
-
45
- Each acts_as_drifter object also gets a distance_to() method that can calculate the
46
- distance to another location:
47
-
48
- >> place = Place.first
49
- >> place.distance_to(other_place)
50
- >> place.distance_to( [10.321, -5.432] )
51
- >> place.distance_to( [10.321, -5.432], :units => :km )
52
-
53
- The location() and location=() methods provide a shortcut for setting lat() and lng():
54
-
55
- >> place = Place.new
56
- >> place.location = [2.222, 3.333]
57
-
58
- >> place.lat
59
- => 2.222
60
- >> place.lng
61
- => 3.333
62
-
63
- Finally, you can use custom names for the lat and lng columns:
64
-
65
- class Place < ActiveRecord::Base
66
- acts_as_drifter :lat_column => :latitude, :lng_column => :longitude
67
- end
68
-
69
-
70
- === License
71
-
72
- MIT License. Copyright 2011 Ahmed Adam (http://github.com/ahmedrb)