Module: StartHer::Subscriber::ClassMethods
- Defined in:
- lib/start_her/subscriber.rb
Instance Attribute Summary collapse
-
#subscriber_error_block ⇒ Object
Returns the value of attribute subscriber_error_block.
-
#subscriber_options_hash ⇒ Object
Returns the value of attribute subscriber_options_hash.
Instance Method Summary collapse
Instance Attribute Details
#subscriber_error_block ⇒ Object
Returns the value of attribute subscriber_error_block.
15 16 17 |
# File 'lib/start_her/subscriber.rb', line 15 def subscriber_error_block @subscriber_error_block end |
#subscriber_options_hash ⇒ Object
Returns the value of attribute subscriber_options_hash.
15 16 17 |
# File 'lib/start_her/subscriber.rb', line 15 def @subscriber_options_hash end |
Instance Method Details
#run! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/start_her/subscriber.rb', line 17 def run! new.tap do |instance| instance.psubscribe([:channels]) do |channel, | begin instance.(channel, ) rescue => e if block_given? subscriber_error_block.call(e) else DEFAULT_ERROR_BLOCK.call(e) end end end end end |
#subscriber_error(&block) ⇒ Object
33 34 35 |
# File 'lib/start_her/subscriber.rb', line 33 def subscriber_error(&block) self.subscriber_error_block = block end |
#subscriber_options(opts = {}) ⇒ Object
37 38 39 |
# File 'lib/start_her/subscriber.rb', line 37 def (opts = {}) self. = DEFAULT_OPTS.merge(opts) end |