celluloid_pubsub 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4b70569e7f3f0e1e118f5b5f14ad6e222f0d0eb
4
- data.tar.gz: 3a65d8be43ea583f8ad71426f18ac228eaa2c7b8
3
+ metadata.gz: 762f09a19b7978a014083ac04ed2117444bb758f
4
+ data.tar.gz: 344636d89975e472df57cef5143ed30a211375be
5
5
  SHA512:
6
- metadata.gz: 1c0190d1d7d247936d3d4f65ec6a2d379b05e829085123f91ee293285e50b7ca9edc5b7573ea642d80167c9fa8bc7889456038d0a2bb4e65d44ba40de26c4d5f
7
- data.tar.gz: d3c5eef75fe9625158225832cbb1f69daca2b58f5dc54aed17ba2cb2203003f92c1f0b79429b871191008924a100f85d681f67bca4378251b9717d2c7ff04dca
6
+ metadata.gz: 9bb978cb0ed74b9835aaeb43105aba2130602a5e841dc968d8f9127cc88a4136b2f8663f6f85feaeac1eec9bf487febd307a8934e816b6fa71397abe5cc5e871
7
+ data.tar.gz: 74b9060bb3d673b41565a9167c745578403aefa59f6a644e89730da72bb337dd928788157f54902c11cc3b955678b62a73698c28ffcffc091137bd9cd778cf41
@@ -185,7 +185,8 @@ module CelluloidPubsub
185
185
  fetch_pubsub do |pubsub|
186
186
  callback = prepare_redis_action(pubsub, action)
187
187
  success_message = action_success(action, channel, message)
188
- subscription = pubsub.send(action, channel, callback)
188
+ args = action_subscribe?(action) ? [channel, callback] : [channel]
189
+ subscription = pubsub.send(action, *args)
189
190
  register_subscription_callbacks(subscription, action, success_message)
190
191
  end
191
192
  end
@@ -233,10 +234,19 @@ module CelluloidPubsub
233
234
  #
234
235
  # @api private
235
236
  def register_subscription_callbacks(subscription, action, sucess_message = nil)
236
- register_redis_callback(subscription, sucess_message)
237
+ register_redis_callback(subscription,action, sucess_message)
237
238
  register_redis_error_callback(subscription, action)
238
239
  end
239
-
240
+ # the method will return true if debug is enabled
241
+ #
242
+ #
243
+ # @return [Boolean] returns true if debug is enabled otherwise false
244
+ #
245
+ # @api public
246
+ def debug_enabled?
247
+ @server.debug_enabled?
248
+ end
249
+
240
250
  # method used to register a success callback and if action is subscribe will write
241
251
  # back to the websocket a message that will say it is a successful_subscription
242
252
  # If action is something else, will log the incoming message
@@ -248,12 +258,12 @@ module CelluloidPubsub
248
258
  # @return [void]
249
259
  #
250
260
  # @api private
251
- def register_redis_callback(subscription, sucess_message = nil)
261
+ def register_redis_callback(subscription, action, sucess_message = nil)
252
262
  subscription.callback do |subscriptions_ids|
253
263
  if sucess_message.present?
254
264
  @websocket << sucess_message.merge('subscriptions' => subscriptions_ids).to_json
255
265
  else
256
- log_debug "#{action} success #{success_response.inspect}"
266
+ log_debug "#{action} success #{sucess_message.inspect}"
257
267
  end
258
268
  end
259
269
  end
@@ -17,7 +17,7 @@ module CelluloidPubsub
17
17
  # minor release version
18
18
  MINOR = 4
19
19
  # tiny release version
20
- TINY = 3
20
+ TINY = 4
21
21
  # prelease version ( set this only if it is a prelease)
22
22
  PRE = nil
23
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada