em-posixmq 0.2.1 → 0.2.2

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/lib/em-posixmq.rb CHANGED
@@ -2,12 +2,13 @@ require "eventmachine"
2
2
  require "posix_mq"
3
3
 
4
4
  require "em-posixmq/version"
5
+ require "em-posixmq/errors"
5
6
 
6
7
 
7
8
  module EventMachine::PosixMQ
8
9
 
9
- class Watcher < EM::Connection
10
- def initialize(posix_mq)
10
+ class Watcher < ::EM::Connection
11
+ def initialize posix_mq
11
12
  @posix_mq = posix_mq
12
13
  @posix_mq.nonblock = true
13
14
  end
@@ -18,18 +19,19 @@ module EventMachine::PosixMQ
18
19
  receive_message message, priority if message
19
20
  end
20
21
 
21
- def receive_message(message, priority)
22
- # This method must be defined in the user's class inherinting this one.
22
+ # This method must be defined in the user's class inherinting this one.
23
+ def receive_message message, priority
24
+ puts "EM::PosixMQ::Watcher#receive_message #{message.inspect}, #{priority.inspect}"
23
25
  end
24
26
  end
25
27
 
26
- def self.run(posix_mq, handler)
27
- raise Error, "EventMachine is not running" unless EM.reactor_running?
28
+ def self.run posix_mq, handler
29
+ raise ::EM::PosixMQ::Error, "EventMachine is not running" unless ::EM.reactor_running?
28
30
 
29
- raise Error, "`posix_mq' argument must be a POSIX_MQ instance" unless
30
- posix_mq.is_a? POSIX_MQ
31
+ raise ::EM::PosixMQ::Error, "`posix_mq' argument must be a POSIX_MQ instance" unless
32
+ posix_mq.is_a? ::POSIX_MQ
31
33
 
32
- conn = EM.watch posix_mq.to_io, handler, posix_mq
34
+ conn = ::EM.watch posix_mq.to_io, handler, posix_mq
33
35
  conn.notify_readable = true
34
36
 
35
37
  return conn
@@ -0,0 +1,5 @@
1
+ module EventMachine
2
+ module PosixMQ
3
+ class Error < ::StandardError ; end
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module PosixMQ
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - "I\xC3\xB1aki Baz Castillo"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-19 00:00:00 +02:00
17
+ date: 2011-12-02 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,6 +56,7 @@ extra_rdoc_files: []
56
56
  files:
57
57
  - lib/em-posixmq.rb
58
58
  - lib/em-posixmq/version.rb
59
+ - lib/em-posixmq/errors.rb
59
60
  - test/test-em-posixmq-client.rb
60
61
  - test/test-em-posixmq-server.rb
61
62
  has_rdoc: true