sugarcube 0.6 → 0.6.1
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/README.md +2 -2
- data/lib/sugarcube/nsstring.rb +3 -6
- data/lib/sugarcube/symbol.rb +2 -6
- data/lib/sugarcube/version.rb +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -80,8 +80,8 @@ end
|
|
80
80
|
|
81
81
|
```ruby
|
82
82
|
# UIImage from name
|
83
|
-
"my_image".uiimage
|
84
|
-
|
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)
|
data/lib/sugarcube/nsstring.rb
CHANGED
@@ -13,7 +13,8 @@ class NSString
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def uifont(size=UIFont.systemFontSize)
|
16
|
-
@uifont
|
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
|
-
|
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._`
|
data/lib/sugarcube/symbol.rb
CHANGED
@@ -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
|
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
|
317
|
+
if size.is_a? Symbol
|
322
318
|
return UIFont.send(Symbol.font_sizes[self])
|
323
319
|
end
|
324
320
|
return size.to_f
|
data/lib/sugarcube/version.rb
CHANGED
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:
|
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-
|
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: &
|
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: *
|
25
|
+
version_requirements: *70179309033960
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
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: *
|
36
|
+
version_requirements: *70179309033020
|
37
37
|
description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
|
38
38
|
make
|
39
39
|
|