graph-bar 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/graph/bar.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 170847767f184c45b3c66b61dd4a34103a8691fe
|
|
4
|
+
data.tar.gz: 06b4c9c15131c2b5f709aeb481a1760d74f9227d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d25917cd6d68313cdcac91b99f8aeafa14e96a33301b6d078296a09c836f489931913b8e8aef91133a1959ffae9bba6a12626eba26f6e7ffde438456f00a7218
|
|
7
|
+
data.tar.gz: e5ee399d2ae59cb56fb87a30c8876d308f1fd16748827abb66f6cfc71217f3fdcf11f13ddd8a954db98316351ff24d617f913b498cc7002fd3bf40e9f4bc3300
|
data/lib/graph/bar.rb
CHANGED
|
@@ -44,7 +44,11 @@ module Graph
|
|
|
44
44
|
# Get or Set the print mode
|
|
45
45
|
#
|
|
46
46
|
def mode(mode = nil)
|
|
47
|
-
|
|
47
|
+
unless mode.nil?
|
|
48
|
+
raise ArgumentError, 'Invalid Print Mode!', caller unless
|
|
49
|
+
[PrintMode::SCALE, PrintMode::NOSCALE].include? mode
|
|
50
|
+
@mode = mode
|
|
51
|
+
end
|
|
48
52
|
@mode
|
|
49
53
|
end
|
|
50
54
|
|
|
@@ -52,7 +56,11 @@ module Graph
|
|
|
52
56
|
# Get or Set th print scale
|
|
53
57
|
#
|
|
54
58
|
def scale(scale = nil)
|
|
55
|
-
|
|
59
|
+
unless scale.nil?
|
|
60
|
+
raise ArgumentError, 'Invalid Scale!', caller unless
|
|
61
|
+
scale > 0
|
|
62
|
+
@scale = scale
|
|
63
|
+
end
|
|
56
64
|
@scale
|
|
57
65
|
end
|
|
58
66
|
|
|
@@ -83,6 +91,7 @@ module Graph
|
|
|
83
91
|
#
|
|
84
92
|
def print_scale(scale = nil)
|
|
85
93
|
scale ||= @scale
|
|
94
|
+
raise ArgumentError, 'Invalid Scale', caller unless scale > 0
|
|
86
95
|
@data.each_with_index do |count, index|
|
|
87
96
|
printf "%02d|%s\n", index, ('#' * (count / scale))
|
|
88
97
|
end
|