beetle_joevandyk_extensions 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,11 +17,16 @@ module BeetleJoevandykExtensions
17
17
  end
18
18
  end
19
19
 
20
- def listen name, &block
20
+ def listen name, klass=nil, &block
21
21
  client = Beetle::Client.new
22
22
  client.register_queue name
23
- client.register_handler name do |input|
24
- block.call(JSON.parse(input.data)).to_json
23
+ client.register_handler name, klass do |input|
24
+ json = JSON.parse(input.data)
25
+ if klass
26
+ klass.call(json).to_json
27
+ else
28
+ block.call(json).to_json
29
+ end
25
30
  end
26
31
  client.listen do
27
32
  puts "Started #{ name } at #{ Time.now }"
@@ -1,3 +1,3 @@
1
1
  module BeetleJoevandykExtensions
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle_joevandyk_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-16 00:00:00.000000000 -07:00
12
+ date: 2011-07-17 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: beetle
17
- requirement: &2157270620 !ruby/object:Gem::Requirement
17
+ requirement: &2164841540 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2157270620
25
+ version_requirements: *2164841540
26
26
  description: Extensions to Beetle
27
27
  email:
28
28
  - joe@fixieconsulting.com