eventmachine-distributed-notification 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = eventmachine-distributed-notification
2
2
 
3
- An {EventMachine}[http://wiki.github.com/eventmachine/eventmachine/] extension to watch OSX's Distributed Notification
3
+ An {EventMachine}[http://wiki.github.com/eventmachine/eventmachine/] extension to watch/post OS X's {Distributed Notification}[https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDistributedNotificationCenter_Class/Reference/Reference.html]
4
4
 
5
5
  == Synopsis
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,7 +1,7 @@
1
1
  #import "observer_native.h"
2
2
 
3
3
  @interface Observer (Private)
4
- - (void) p_iTunesPlayStatusChanged:(NSNotification *)theNotification;
4
+ - (void) notify:(NSNotification *)theNotification;
5
5
  @end
6
6
 
7
7
  @implementation Observer
@@ -12,6 +12,7 @@
12
12
  - (void)dealloc
13
13
  {
14
14
  [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
15
+ [name release];
15
16
  [super dealloc];
16
17
  }
17
18
 
@@ -19,13 +20,13 @@
19
20
  {
20
21
  [[NSDistributedNotificationCenter defaultCenter]
21
22
  addObserver:self
22
- selector:@selector(p_iTunesPlayStatusChanged:)
23
+ selector:@selector(notify:)
23
24
  name:(name != nil) ? name : nil
24
25
  object:nil
25
26
  ];
26
27
  }
27
28
 
28
- - (void)p_iTunesPlayStatusChanged:(NSNotification *)theNotification
29
+ - (void)notify:(NSNotification *)theNotification
29
30
  {
30
31
  VALUE aName = rb_str_new2([[theNotification name] UTF8String]);
31
32
  NSDictionary *userInfo = [theNotification userInfo];
@@ -35,8 +36,6 @@
35
36
  rb_hash_aset(hash, rb_str_new2([[key description] UTF8String]), rb_str_new2([[[userInfo objectForKey:key] description] UTF8String]));
36
37
  }
37
38
 
38
- //const char *description = [[[theNotification userInfo] description] UTF8String];
39
-
40
39
  rb_funcall(handler, rb_intern("notify"), 2, aName, hash);
41
40
  }
42
41
 
@@ -57,6 +56,10 @@ Observer *getObserver(VALUE obj) {
57
56
  }
58
57
 
59
58
  void cObserverNative_free(void *ptr) {
59
+ Observer *obs = (Observer *)(((struct ObserverObject *)ptr)->obs);
60
+
61
+ [obs release];
62
+
60
63
  free(ptr);
61
64
  }
62
65
 
@@ -82,27 +85,17 @@ static VALUE cObserverNative_new(int argc, VALUE *argv, VALUE klass)
82
85
  obj = createInstanceFromObserver(obs);
83
86
 
84
87
  if(RTEST(name)) {
85
- [obs setName:[NSString stringWithUTF8String:StringValuePtr(name)]];
88
+ [obs setName:[[NSString stringWithUTF8String:StringValuePtr(name)] retain]];
86
89
  }
87
90
 
88
91
  [obs setHandler:handler];
89
92
  [obs observe];
90
93
 
94
+ [pool release];
95
+
91
96
  return obj;
92
97
  }
93
98
 
94
- // static VALUE cObserverNative_notify(int argc, VALUE *argv, VALUE self)
95
- // {
96
- // VALUE name, hash;
97
-
98
- // rb_scan_args(argc, argv, "2", &name, &hash);
99
-
100
- // rb_p(name);
101
- // rb_p(hash);
102
-
103
- // return Qnil;
104
- // }
105
-
106
99
  static VALUE cObserverNative_run(int argc, VALUE *argv, VALUE self)
107
100
  {
108
101
  [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
@@ -124,7 +117,6 @@ void Init_observer_native(void){
124
117
  rb_mDistributedNotification = rb_define_module_under(rb_mEventMachine, "DistributedNotification");
125
118
  rb_cObserverNative = rb_define_class_under(rb_mDistributedNotification, "ObserverNative", rb_cObject);
126
119
  rb_define_singleton_method(rb_cObserverNative, "new", cObserverNative_new, -1);
127
- //rb_define_method(rb_cObserverNative, "notify", cObserverNative_notify, -1);
128
120
  rb_define_method(rb_cObserverNative, "run", cObserverNative_run, -1);
129
121
  rb_define_method(rb_cObserverNative, "run_forever", cObserverNative_run_forever, -1);
130
122
  }
@@ -19,8 +19,6 @@ VALUE createInstance() {
19
19
 
20
20
  static VALUE cPosterNative_new(int argc, VALUE *argv, VALUE klass)
21
21
  {
22
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
23
-
24
22
  return createInstance();
25
23
  }
26
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventmachine-distributed-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-22 00:00:00.000000000 Z
12
+ date: 2012-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &70185138676260 !ruby/object:Gem::Requirement
16
+ requirement: &70365728629340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70185138676260
24
+ version_requirements: *70365728629340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70185138674940 !ruby/object:Gem::Requirement
27
+ requirement: &70365728628160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70185138674940
35
+ version_requirements: *70365728628160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &70185138673060 !ruby/object:Gem::Requirement
38
+ requirement: &70365728626080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.12'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70185138673060
46
+ version_requirements: *70365728626080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70185138684820 !ruby/object:Gem::Requirement
49
+ requirement: &70365728638000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70185138684820
57
+ version_requirements: *70365728638000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70185138682440 !ruby/object:Gem::Requirement
60
+ requirement: &70365728635600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.8.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70185138682440
68
+ version_requirements: *70365728635600
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rb-appscript
71
- requirement: &70185138681200 !ruby/object:Gem::Requirement
71
+ requirement: &70365728634300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70185138681200
79
+ version_requirements: *70365728634300
80
80
  description: An EventMachine extension to watch OSX's Distributed Notification, posted
81
81
  by iTunes etc.
82
82
  email: youpy@buycheapviagraonlinenow.com
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -3278988449120356185
126
+ hash: -3731233453672079385
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements: