clumpy 0.2.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/clumpy.rb +0 -2
- data/lib/clumpy/version.rb +1 -1
- data/spec/cluster_behavior_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -4
- metadata +17 -19
- data/lib/clumpy/extensions/chewy_hit.rb +0 -20
- data/lib/clumpy/extensions/sunspot_hit.rb +0 -20
- data/spec/extensions/sunspot_hit_spec.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54e552fb799c83627510c3743f36d36682a955f
|
4
|
+
data.tar.gz: b153298fb72ae0ad278fce078aa85a52c9b18f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41ce0b359bdef855b1674e50eebb1798be6f5245446b8686a4bb8f7deb1e9a4311a33fbb3892b060297698591059686cd34bf465ea761c783d0e6797402a5fb3
|
7
|
+
data.tar.gz: afa4c35a0d83673e7de4daa6bd7025d257c9707b40a94356236d890b3084baa43f1bb9580f3e741911cefcaa2ca20ac9dab6aaa526b7e86ce66b7a25b6445434
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.1.4
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -15,7 +15,7 @@ As part of the Gemfile or by hand, nothing unusual here.
|
|
15
15
|
|
16
16
|
Clumpy takes points, typically geocoordinates, and puts them together into clusters.
|
17
17
|
|
18
|
-
It requires the given points to be ruby objects, responding to
|
18
|
+
It requires the given points to be ruby objects, responding to `#latitude` and `#longitude` methods.
|
19
19
|
|
20
20
|
```ruby
|
21
21
|
require 'ostruct'
|
data/lib/clumpy.rb
CHANGED
data/lib/clumpy/version.rb
CHANGED
@@ -50,11 +50,11 @@ describe Clumpy::ClusterBehavior do
|
|
50
50
|
|
51
51
|
context "#contains" do
|
52
52
|
it "returns true if the given point is within the bounds" do
|
53
|
-
cluster.contains?(point).should
|
53
|
+
cluster.contains?(point).should eq true
|
54
54
|
end
|
55
55
|
|
56
56
|
it "returns false for a points that isn't contained" do
|
57
|
-
cluster.contains?(other_point).should
|
57
|
+
cluster.contains?(other_point).should eq false
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clumpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Opper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Cluster points e.g. for a map
|
@@ -73,9 +73,11 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .
|
78
|
-
- .ruby-
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".ruby-gemset"
|
79
|
+
- ".ruby-version"
|
80
|
+
- CHANGELOG.md
|
79
81
|
- Gemfile
|
80
82
|
- LICENSE.txt
|
81
83
|
- README.md
|
@@ -86,12 +88,9 @@ files:
|
|
86
88
|
- lib/clumpy/builder.rb
|
87
89
|
- lib/clumpy/cluster.rb
|
88
90
|
- lib/clumpy/cluster_behavior.rb
|
89
|
-
- lib/clumpy/extensions/chewy_hit.rb
|
90
|
-
- lib/clumpy/extensions/sunspot_hit.rb
|
91
91
|
- lib/clumpy/version.rb
|
92
92
|
- spec/builder_spec.rb
|
93
93
|
- spec/cluster_behavior_spec.rb
|
94
|
-
- spec/extensions/sunspot_hit_spec.rb
|
95
94
|
- spec/spec_helper.rb
|
96
95
|
homepage: http://github.com/xijo/clumpy
|
97
96
|
licenses:
|
@@ -103,12 +102,12 @@ require_paths:
|
|
103
102
|
- lib
|
104
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
104
|
requirements:
|
106
|
-
- -
|
105
|
+
- - ">="
|
107
106
|
- !ruby/object:Gem::Version
|
108
107
|
version: '0'
|
109
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
109
|
requirements:
|
111
|
-
- -
|
110
|
+
- - ">="
|
112
111
|
- !ruby/object:Gem::Version
|
113
112
|
version: '0'
|
114
113
|
requirements: []
|
@@ -120,5 +119,4 @@ summary: Cluster a bunch of points
|
|
120
119
|
test_files:
|
121
120
|
- spec/builder_spec.rb
|
122
121
|
- spec/cluster_behavior_spec.rb
|
123
|
-
- spec/extensions/sunspot_hit_spec.rb
|
124
122
|
- spec/spec_helper.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Clumpy
|
2
|
-
module Extensions
|
3
|
-
module ChewyHit
|
4
|
-
def latitude
|
5
|
-
@latitude ||= _source.lat.to_f
|
6
|
-
end
|
7
|
-
|
8
|
-
def longitude
|
9
|
-
@longitude ||= _source.lng.to_f
|
10
|
-
end
|
11
|
-
|
12
|
-
def as_json(*)
|
13
|
-
{
|
14
|
-
id: _source.id,
|
15
|
-
type: _source.full?(:type) || type.classify
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Clumpy
|
2
|
-
module Extensions
|
3
|
-
module SunspotHit
|
4
|
-
def latitude
|
5
|
-
@latitude ||= stored(:lat)
|
6
|
-
end
|
7
|
-
|
8
|
-
def longitude
|
9
|
-
@longitude ||= stored(:lng)
|
10
|
-
end
|
11
|
-
|
12
|
-
def as_json(*)
|
13
|
-
{
|
14
|
-
id: primary_key,
|
15
|
-
type: class_name
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class Hit
|
4
|
-
def primary_key
|
5
|
-
:foo
|
6
|
-
end
|
7
|
-
|
8
|
-
def class_name
|
9
|
-
'Foo'
|
10
|
-
end
|
11
|
-
|
12
|
-
def stored(key)
|
13
|
-
key
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe Clumpy::Extensions::SunspotHit do
|
18
|
-
let(:hit) { Hit.new }
|
19
|
-
let(:extended_hit) { Hit.new.extend(Clumpy::Extensions::SunspotHit) }
|
20
|
-
|
21
|
-
it "adds #latitude method" do
|
22
|
-
hit.should_not respond_to :latitude
|
23
|
-
extended_hit.should respond_to :latitude
|
24
|
-
extended_hit.latitude.should eq :lat
|
25
|
-
end
|
26
|
-
|
27
|
-
it "adds #longitude method" do
|
28
|
-
hit.should_not respond_to :longitude
|
29
|
-
extended_hit.should respond_to :longitude
|
30
|
-
extended_hit.longitude.should eq :lng
|
31
|
-
end
|
32
|
-
|
33
|
-
it "overrides as_json to return minimal representation" do
|
34
|
-
extended_hit.as_json.should eq({ id: :foo, type: 'Foo' })
|
35
|
-
end
|
36
|
-
end
|