celluloid_pubsub 0.4.2 → 0.4.3
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.
- checksums.yaml +4 -4
- data/examples/shared_classes.rb +0 -1
- data/lib/celluloid_pubsub/redis_reactor.rb +2 -2
- data/lib/celluloid_pubsub/version.rb +1 -1
- data/lib/celluloid_pubsub/web_server.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b70569e7f3f0e1e118f5b5f14ad6e222f0d0eb
|
4
|
+
data.tar.gz: 3a65d8be43ea583f8ad71426f18ac228eaa2c7b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c0190d1d7d247936d3d4f65ec6a2d379b05e829085123f91ee293285e50b7ca9edc5b7573ea642d80167c9fa8bc7889456038d0a2bb4e65d44ba40de26c4d5f
|
7
|
+
data.tar.gz: d3c5eef75fe9625158225832cbb1f69daca2b58f5dc54aed17ba2cb2203003f92c1f0b79429b871191008924a100f85d681f67bca4378251b9717d2c7ff04dca
|
data/examples/shared_classes.rb
CHANGED
@@ -6,7 +6,6 @@ debug_enabled = ENV['DEBUG'].present? && ENV['DEBUG'].to_s == 'true'
|
|
6
6
|
use_redis = ENV['USE_REDIS'].present? && ENV['USE_REDIS'].to_s == 'true'
|
7
7
|
log_file_path = File.join(File.expand_path(File.dirname(__FILE__)), 'log', 'celluloid_pubsub.log')
|
8
8
|
|
9
|
-
|
10
9
|
# actor that subscribes to a channel
|
11
10
|
class Subscriber
|
12
11
|
include Celluloid
|
@@ -183,7 +183,7 @@ module CelluloidPubsub
|
|
183
183
|
# @api private
|
184
184
|
def redis_action(action, channel = nil, message = {})
|
185
185
|
fetch_pubsub do |pubsub|
|
186
|
-
callback = prepare_redis_action(action)
|
186
|
+
callback = prepare_redis_action(pubsub, action)
|
187
187
|
success_message = action_success(action, channel, message)
|
188
188
|
subscription = pubsub.send(action, channel, callback)
|
189
189
|
register_subscription_callbacks(subscription, action, success_message)
|
@@ -199,7 +199,7 @@ module CelluloidPubsub
|
|
199
199
|
# @return [void]
|
200
200
|
#
|
201
201
|
# @api private
|
202
|
-
def prepare_redis_action(action)
|
202
|
+
def prepare_redis_action(pubsub, action)
|
203
203
|
log_unsubscriptions(pubsub)
|
204
204
|
proc do |subscribed_message|
|
205
205
|
action_subscribe?(action) ? (@websocket << subscribed_message) : log_debug(message)
|
@@ -24,7 +24,7 @@ module CelluloidPubsub
|
|
24
24
|
# The request path that the webserver accepts by default
|
25
25
|
PATH = '/ws'
|
26
26
|
|
27
|
-
attr_accessor :
|
27
|
+
attr_accessor :server_options, :subscribers
|
28
28
|
finalizer :shutdown
|
29
29
|
# receives a list of options that are used to configure the webserver
|
30
30
|
#
|
@@ -41,7 +41,7 @@ module CelluloidPubsub
|
|
41
41
|
# :nocov:
|
42
42
|
def initialize(options = {})
|
43
43
|
Celluloid.boot unless Celluloid.running?
|
44
|
-
@
|
44
|
+
@server_options = parse_options(options)
|
45
45
|
@subscribers = {}
|
46
46
|
setup_celluloid_logger
|
47
47
|
log_debug "CelluloidPubsub::WebServer example starting on #{hostname}:#{port}"
|
@@ -55,7 +55,7 @@ module CelluloidPubsub
|
|
55
55
|
#
|
56
56
|
# @api public
|
57
57
|
def use_redis
|
58
|
-
@use_redis
|
58
|
+
@use_redis = @server_options.fetch('use_redis', false)
|
59
59
|
end
|
60
60
|
|
61
61
|
# the method will return true if debug is enabled otherwise false
|
@@ -65,7 +65,7 @@ module CelluloidPubsub
|
|
65
65
|
#
|
66
66
|
# @api public
|
67
67
|
def debug_enabled?
|
68
|
-
@debug_enabled = @
|
68
|
+
@debug_enabled = @server_options.fetch('enable_debug', false)
|
69
69
|
@debug_enabled == true
|
70
70
|
end
|
71
71
|
|
@@ -87,7 +87,7 @@ module CelluloidPubsub
|
|
87
87
|
#
|
88
88
|
# @api public
|
89
89
|
def log_file_path
|
90
|
-
@log_file_path
|
90
|
+
@log_file_path = @server_options.fetch('log_file_path', nil)
|
91
91
|
end
|
92
92
|
|
93
93
|
# the method will return the hostname on which the server is running on
|
@@ -97,7 +97,7 @@ module CelluloidPubsub
|
|
97
97
|
#
|
98
98
|
# @api public
|
99
99
|
def hostname
|
100
|
-
@hostname
|
100
|
+
@hostname = @server_options.fetch('hostname', CelluloidPubsub::WebServer::HOST)
|
101
101
|
end
|
102
102
|
|
103
103
|
# the method will return the port on which will accept connections
|
@@ -107,7 +107,7 @@ module CelluloidPubsub
|
|
107
107
|
#
|
108
108
|
# @api public
|
109
109
|
def port
|
110
|
-
@port
|
110
|
+
@port = @server_options.fetch('port', CelluloidPubsub::WebServer::PORT)
|
111
111
|
end
|
112
112
|
|
113
113
|
# the method will return the URL path on which will acceept connections
|
@@ -117,7 +117,7 @@ module CelluloidPubsub
|
|
117
117
|
#
|
118
118
|
# @api public
|
119
119
|
def path
|
120
|
-
@path
|
120
|
+
@path = @server_options.fetch('path', CelluloidPubsub::WebServer::PATH)
|
121
121
|
end
|
122
122
|
|
123
123
|
# the method will return true if connection to the server should be spied upon
|
@@ -127,7 +127,7 @@ module CelluloidPubsub
|
|
127
127
|
#
|
128
128
|
# @api public
|
129
129
|
def spy
|
130
|
-
@spy
|
130
|
+
@spy = @server_options.fetch('spy', false)
|
131
131
|
end
|
132
132
|
|
133
133
|
# the method will return the number of connections allowed to the server
|
@@ -137,7 +137,7 @@ module CelluloidPubsub
|
|
137
137
|
#
|
138
138
|
# @api public
|
139
139
|
def backlog
|
140
|
-
@backlog = @
|
140
|
+
@backlog = @server_options.fetch('backlog', 1024)
|
141
141
|
end
|
142
142
|
|
143
143
|
# the method will return true if redis is enabled otherwise false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid_pubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|