slicer 0.0.1 → 0.0.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.
@@ -6,19 +6,34 @@ class Slicer
6
6
  # { :general_admission => some_things, :vip => some_other_things }
7
7
  #
8
8
 
9
- cattr_accessor :color
10
- @@color = 0x8B0000
9
+ cattr_accessor :colors
10
+ @@colors = ["#00B85C",
11
+ "#00CC66",
12
+ "#19D175",
13
+ "#33D685",
14
+ "#4DDB94",
15
+ "#66E0A3",
16
+ "#80E6B2",
17
+ "#99EBC2",
18
+ "#B2F0D1",
19
+ "#CCF5E0",
20
+ "#E6FAF0",
21
+ "#0066CC",
22
+ "#1975D1",
23
+ "#3385D6",
24
+ "#4D94DB",
25
+ "#66A3E0",
26
+ "#80B2E6",
27
+ "#99C2EB",
28
+ "#B2D1F0",
29
+ "#CCE0F5",
30
+ "#E6F0FA"]
11
31
 
12
- def self.html_color(hex)
13
- "#%06x" % hex
14
- end
15
-
16
- def self.darker
17
- @@color = @@color - 0x111111
18
- end
32
+ @@color_index = 0
19
33
 
20
- def self.lighter
21
- @@color = @@color + 0x001C07
34
+ def self.pop_color
35
+ @@color_index = (@@color_index == @@colors.length-1) ? @@color_index = 0 : @@color_index + 1
36
+ @@colors[@@color_index]
22
37
  end
23
38
 
24
39
  def self.slice(root_slice, things, procs, current_depth=0)
@@ -30,8 +45,7 @@ class Slicer
30
45
  Array.wrap(map.keys).each do |kee|
31
46
  current_slice = Slice.new(kee)
32
47
  if(procs.length == current_depth+1)
33
- current_slice.color = html_color(@@color)
34
- lighter
48
+ current_slice.color = pop_color
35
49
  current_slice.value = map[kee].length
36
50
  end
37
51
  root_slice.children << slice(current_slice, map[kee], procs, current_depth+1)
@@ -1,3 +1,3 @@
1
1
  class Slicer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slicer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: