clumpy 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/clumpy/cluster_behavior.rb +7 -2
- data/lib/clumpy/version.rb +1 -1
- data/spec/cluster_behavior_spec.rb +23 -0
- metadata +29 -13
- checksums.yaml +0 -7
@@ -34,8 +34,13 @@ module Clumpy
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def value_list
|
37
|
-
|
38
|
-
|
37
|
+
case @options[:include_values]
|
38
|
+
when true then points
|
39
|
+
when false then []
|
40
|
+
else
|
41
|
+
values_threshold = @options[:values_threshold] || 10
|
42
|
+
points.size <= values_threshold ? points : []
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
def bounds_as_json
|
data/lib/clumpy/version.rb
CHANGED
@@ -25,6 +25,29 @@ describe Clumpy::ClusterBehavior do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
context "#value_list" do
|
29
|
+
it "returns an empty array if threshold isn't reached" do
|
30
|
+
cluster = Clumpy::Cluster.new(point, 10, values_threshold: 1)
|
31
|
+
cluster.points << other_point
|
32
|
+
cluster.value_list.should eq []
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns an array of json points if under threshold" do
|
36
|
+
cluster = Clumpy::Cluster.new(point, 10, values_threshold: 1)
|
37
|
+
cluster.value_list.should eq [point]
|
38
|
+
end
|
39
|
+
|
40
|
+
it "returns a list of values if include_values is true" do
|
41
|
+
cluster = Clumpy::Cluster.new(point, 10, values_threshold: 0, include_values: true)
|
42
|
+
cluster.value_list.should eq [point]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns a empty list if include_values is false" do
|
46
|
+
cluster = Clumpy::Cluster.new(point, 10, values_threshold: 10, include_values: false)
|
47
|
+
cluster.value_list.should eq []
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
28
51
|
context "#contains" do
|
29
52
|
it "returns true if the given point is within the bounds" do
|
30
53
|
cluster.contains?(point).should be_true
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clumpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Johannes Opper
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-04-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,43 +30,49 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: simplecov
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- - '>='
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- - '>='
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0'
|
69
78
|
description: Cluster points e.g. for a map
|
@@ -92,26 +101,33 @@ files:
|
|
92
101
|
homepage: http://github.com/xijo/clumpy
|
93
102
|
licenses:
|
94
103
|
- WTFPL
|
95
|
-
metadata: {}
|
96
104
|
post_install_message:
|
97
105
|
rdoc_options: []
|
98
106
|
require_paths:
|
99
107
|
- lib
|
100
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
101
110
|
requirements:
|
102
|
-
- - '>='
|
111
|
+
- - ! '>='
|
103
112
|
- !ruby/object:Gem::Version
|
104
113
|
version: '0'
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
hash: 2390143742544744460
|
105
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
106
119
|
requirements:
|
107
|
-
- - '>='
|
120
|
+
- - ! '>='
|
108
121
|
- !ruby/object:Gem::Version
|
109
122
|
version: '0'
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
hash: 2390143742544744460
|
110
126
|
requirements: []
|
111
127
|
rubyforge_project:
|
112
|
-
rubygems_version:
|
128
|
+
rubygems_version: 1.8.25
|
113
129
|
signing_key:
|
114
|
-
specification_version:
|
130
|
+
specification_version: 3
|
115
131
|
summary: Cluster a bunch of points
|
116
132
|
test_files:
|
117
133
|
- spec/builder_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: a098909784fa383eb4f35a22ca1047c8420b7f24
|
4
|
-
data.tar.gz: 20f94e3674bcde0a04a14690ca9e9fdaeef8a002
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 804979e09ec478f0db7c983bfb2734552abaf908bf1949378210d10b87f9a424916cd5c0b44d18a862c7e0a7656584181547876e4f8fb5068b08f6ad4badc0c5
|
7
|
-
data.tar.gz: 3173e9fd9ade10ce884149c502ab69a2e0bf033c9eae019f5cb52b8a832df3d784d3f008475b27e5902122ed2974ce7ae4b02cf9264caa79bf6ef82cd33d659e
|