sugarcube 0.20.17 → 0.20.18

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (0.20.16)
4
+ sugarcube (0.20.18)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,6 +2,7 @@ class Symbol
2
2
  class << self
3
3
  attr :uicolors
4
4
  attr :css_colors
5
+ attr :css_colors_cache
5
6
  end
6
7
 
7
8
  def uicolor(alpha=nil)
@@ -12,15 +13,16 @@ class Symbol
12
13
  if not alpha.nil?
13
14
  color = color.colorWithAlphaComponent(alpha.to_f)
14
15
  end
16
+ elsif Symbol.css_colors_cache.has_key? self
17
+ color = Symbol.css_colors_cache[self]
15
18
  else
16
19
  # css colors
17
20
  color = sugarcube_look_in(Symbol.css_colors).uicolor
18
- Symbol.css_colors[self] = color
19
- if alpha.nil?
20
- color
21
- else
22
- color.uicolor(alpha)
23
- end
21
+ Symbol.css_colors_cache[self] = color
22
+ end
23
+
24
+ if alpha
25
+ color = color.uicolor(alpha)
24
26
  end
25
27
 
26
28
  color
@@ -52,6 +54,7 @@ class Symbol
52
54
  under_page: :underPageBackgroundColor,
53
55
  }
54
56
 
57
+ @css_colors_cache = {}
55
58
  @css_colors = {
56
59
  # for css_name to pick up on these colors, they need to be defined here
57
60
  black: 0x000000,
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.20.17'
2
+ Version = '0.20.18'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.17
4
+ version: 0.20.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-04-27 00:00:00.000000000 Z
16
+ date: 2013-04-28 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description: ! '== Description
19
19