sugarcube 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -0
- data/lib/sugarcube/defaults.rb +21 -0
- data/lib/sugarcube/notifications.rb +0 -12
- data/lib/sugarcube/version.rb +1 -1
- metadata +6 -5
data/README.md
CHANGED
@@ -74,6 +74,14 @@ Makes it easy to post a notification to some or all objects.
|
|
74
74
|
```ruby
|
75
75
|
# see String for easy URL creation
|
76
76
|
"https://github.com".nsurl.open # => UIApplication.sharedApplication.openURL(NSURL.URLWithString("https://github.com"))
|
77
|
+
```
|
78
|
+
|
79
|
+
NSUserDefaults
|
80
|
+
----------------
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
['any', 'objects'].save_to_default(:key) # => NSUserDefaults.standardUserDefaults.setObject(['any', 'objects'], forKey: :key)
|
84
|
+
:key.get_default # => NSUserDefaults.standardUserDefaults.objectForKey(:key)
|
77
85
|
```
|
78
86
|
|
79
87
|
String
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
class Symbol
|
3
|
+
|
4
|
+
def get_default
|
5
|
+
NSUserDefaults.standardUserDefaults.objectForKey(self)
|
6
|
+
end
|
7
|
+
|
8
|
+
def remove_default
|
9
|
+
NSUserDefaults.standardUserDefaults.removeObjectForKey(self)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
class Object
|
16
|
+
|
17
|
+
def save_to_default(key)
|
18
|
+
NSUserDefaults.standardUserDefaults.setObject(self, forKey:key)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,16 +1,4 @@
|
|
1
|
-
=begin
|
2
|
-
"my notification".observe(obj, :notified)
|
3
|
-
# => NSNotificationCenter.defaultCenter.addObserver(obj, selector::'notified:', name:"my notification", object: nil)
|
4
|
-
"my notification".observe(obj) { |notification| puts notification }
|
5
|
-
# => NSNotificationCenter.defaultCenter.addObserver(obj, selector::'__sugarcube_notified__:', name:"my notification", object: Proc.new { |notification| puts notification })
|
6
|
-
"my notification".observe { |notification| puts notification }
|
7
|
-
# => NSNotificationCenter.defaultCenter.addObserverForName("my notification", object: nil, queue:NSOperationQueue.mainQueue, usingBlock:{ |notification| puts notification })
|
8
1
|
|
9
|
-
"my notification".removeObserver(obj)
|
10
|
-
# => NSNotificationCenter.defaultCenter.removeObserver(object, name:"my notification", object: nil)
|
11
|
-
"my notification".removeObserver(obj, obj2)
|
12
|
-
# => NSNotificationCenter.defaultCenter.removeObserver(object, name:"my notification", object: obj2)
|
13
|
-
=end
|
14
2
|
|
15
3
|
class String
|
16
4
|
|
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: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-07-11 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &70156160598480 !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: *70156160598480
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
requirement: &
|
28
|
+
requirement: &70156160597880 !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: *70156160597880
|
37
37
|
description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
|
38
38
|
make
|
39
39
|
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- Rakefile
|
66
66
|
- lib/sugarcube.rb
|
67
67
|
- lib/sugarcube/core_graphics.rb
|
68
|
+
- lib/sugarcube/defaults.rb
|
68
69
|
- lib/sugarcube/document.rb
|
69
70
|
- lib/sugarcube/exceptions.rb
|
70
71
|
- lib/sugarcube/fixnum.rb
|