pubby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,9 @@ module Pubby
16
16
  raise "unknown type #{type.inspect}"
17
17
  end
18
18
 
19
- klass.from_config(config)
19
+ result = klass.from_config(config)
20
+ result = Pubby::SimpleAsync.new(result) if config['async']
21
+ result
20
22
  end
21
23
 
22
24
  end
@@ -10,13 +10,14 @@ class Pubby::Pubnub
10
10
 
11
11
  def publish(channel_name, message)
12
12
  @pubnub.publish('channel' => channel_name, 'message' => message)
13
+ true
13
14
  end
14
15
 
15
16
  def self.from_config(config)
16
17
  new(
17
18
  Pubnub.new(
18
19
  config.fetch('publish_key') { raise "publish_key is required" },
19
- config.fetch('subscribe_key', ''),
20
+ config.fetch('subscribe_key') { raise "subscribe_key is required" },
20
21
  config.fetch('secret_key', ''),
21
22
  config.fetch('ssl_on', false)
22
23
  )
@@ -17,6 +17,7 @@ class Pubby::SimpleAsync
17
17
 
18
18
  def publish(channel, message)
19
19
  @queue << [channel, message]
20
+ true
20
21
  end
21
22
 
22
23
  def shutdown!
@@ -36,7 +37,7 @@ class Pubby::SimpleAsync
36
37
  def start_threads!
37
38
  @thread_count.times do
38
39
  @threads << Thread.new do
39
- Thread.abort_on_exception = true
40
+ Thread.abort_on_exception = false
40
41
  process_messages!
41
42
  end
42
43
  end
@@ -12,6 +12,7 @@ class Pubby::Stub
12
12
 
13
13
  def publish(channel_name, message)
14
14
  @messages[channel_name] << message
15
+ true
15
16
  end
16
17
 
17
18
  def messages
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: