sugarcube 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -80,8 +80,8 @@ end
80
80
 
81
81
  ```ruby
82
82
  # UIImage from name
83
- "my_image".uiimage # => UIImage.imageNamed("my_image")
84
- # (if you have an image named "blue", use "blue".uiimage.uicolor)
83
+ "my_image".uiimage # => UIImage.imageNamed("my_image")
84
+ "blue".uicolor # => UIColor.colorWithPatternImage(UIImage.imageNamed("blue"))
85
85
 
86
86
  # UIFont from name
87
87
  "my_font".uifont # => UIFont.fontWithName("my_font", size:UIFont.systemFontSize)
@@ -13,7 +13,8 @@ class NSString
13
13
  end
14
14
 
15
15
  def uifont(size=UIFont.systemFontSize)
16
- @uifont = UIFont.fontWithName(self, size:size)
16
+ @uifont ||= {}
17
+ @uifont[size] ||= UIFont.fontWithName(self, size:size)
17
18
  end
18
19
 
19
20
  def uicolor(alpha=nil)
@@ -26,11 +27,7 @@ class NSString
26
27
  return self[1..-1].to_i(16).uicolor(alpha)
27
28
  end
28
29
 
29
- begin
30
- self.to_sym.uicolor(alpha)
31
- rescue SugarNotFoundException
32
- self.uiimage.uicolor(alpha)
33
- end
30
+ self.uiimage.uicolor(alpha)
34
31
  end
35
32
 
36
33
  # This can be called as `"Hello".localized` or `"Hello"._`. The `str._`
@@ -230,10 +230,6 @@ class Symbol
230
230
  public
231
231
  def uidevice
232
232
  look_in(Symbol.devices)
233
- if Symbol.devices[self]
234
- return Symbol.devices[self]
235
- end
236
- raise SugarNotFoundException.new(self)
237
233
  end
238
234
 
239
235
  def uitextalignment
@@ -305,7 +301,7 @@ class Symbol
305
301
  # system fonts
306
302
  if Symbol.system_fonts.has_key? self
307
303
  font = look_in(Symbol.system_fonts)
308
- if Symbol === size
304
+ if size.is_a? Symbol
309
305
  size = Symbol.font_sizes.fetch(size).uifontsize
310
306
  end
311
307
  font = UIFont.send(font, size)
@@ -318,7 +314,7 @@ class Symbol
318
314
 
319
315
  def uifontsize
320
316
  size = look_in(Symbol.system_fonts)
321
- if Symbol === size
317
+ if size.is_a? Symbol
322
318
  return UIFont.send(Symbol.font_sizes[self])
323
319
  end
324
320
  return size.to_f
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.6'
2
+ Version = '0.6.1'
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.6'
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-30 00:00:00.000000000 Z
13
+ date: 2012-08-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70171931302100 !ruby/object:Gem::Requirement
17
+ requirement: &70179309033960 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70171931302100
25
+ version_requirements: *70179309033960
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70171931301160 !ruby/object:Gem::Requirement
28
+ requirement: &70179309033020 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70171931301160
36
+ version_requirements: *70179309033020
37
37
  description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
38
38
  make
39
39