to_bar_graph 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bucketizer.rb +5 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934d4994a754c78b54375842e37c10e378971948
|
4
|
+
data.tar.gz: 9da9dfe3a9dbdaf1b10059d21cfcae24f89ceb15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3a895cc2b085be3fcae0079561e094acfa787a8f7157fb33746af5b97154916592e987c0bbb8447fe77368d9669855b9a8bc7c770881224fe4c32a6cd856b4
|
7
|
+
data.tar.gz: 9748492885997d62cb52443b01df734cb178b6648a27c5a15154db4c1d83bb33e2d59287a1083d6fbbb22b25f9e51e014a5656acd2ee56fbed8ece1534f9f4bf
|
data/lib/bucketizer.rb
CHANGED
@@ -18,6 +18,8 @@ module ToBarGraph
|
|
18
18
|
def create_buckets_from_array
|
19
19
|
buckets = {}
|
20
20
|
|
21
|
+
@data.delete(nil)
|
22
|
+
|
21
23
|
@data.each do |e|
|
22
24
|
buckets[e] ||= 0
|
23
25
|
buckets[e] += 1
|
@@ -29,11 +31,13 @@ module ToBarGraph
|
|
29
31
|
def create_buckets_from_hash
|
30
32
|
buckets = {}
|
31
33
|
|
32
|
-
@data.each { |k, v| buckets[k] = v }
|
34
|
+
@data.each { |k, v| buckets[k] = v unless (v.nil? || k.nil?) }
|
33
35
|
|
34
36
|
if(buckets.any? { |k, v| v.is_a?(String) })
|
35
37
|
return buckets.map { |k, v| [k, v.to_i] }.to_h
|
36
38
|
end
|
39
|
+
|
40
|
+
|
37
41
|
|
38
42
|
return buckets
|
39
43
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_bar_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: 'Adds #to_bar_graph to Array and to Hash
|
14
|
-
to stdout.'
|
13
|
+
description: 'Adds #to_bar_graph to Array and to Hash, returns a bar graph object,
|
14
|
+
and optionally prints a simple bar graph to stdout.'
|
15
15
|
email: brettcsykes@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|