Class: DRbQueue::Configuration
- Inherits:
-
Object
- Object
- DRbQueue::Configuration
- Defined in:
- lib/drb_queue/configuration.rb
Instance Attribute Summary collapse
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#immediate ⇒ Object
Returns the value of attribute immediate.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#num_workers ⇒ Object
Returns the value of attribute num_workers.
-
#persistence_store ⇒ Object
Returns the value of attribute persistence_store.
-
#socket_location ⇒ Object
Returns the value of attribute socket_location.
Instance Method Summary collapse
- #after_fork(&block) ⇒ Object
- #after_fork_callbacks ⇒ Object
- #before_fork(&block) ⇒ Object
- #before_fork_callbacks ⇒ Object
- #construct_persistence_store ⇒ Object
- #immediate! ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #on_error(&block) ⇒ Object
- #server_uri ⇒ Object
- #store(klass, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 |
# File 'lib/drb_queue/configuration.rb', line 5 def initialize self.socket_location = '/tmp/drb_queue' self.num_workers = 1 self.logger = Logger.new(STDOUT) self.error_handler = lambda { |e| logger.error(([e.] + e.backtrace).join("\n")) } end |
Instance Attribute Details
#error_handler ⇒ Object
Returns the value of attribute error_handler.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def error_handler @error_handler end |
#immediate ⇒ Object
Returns the value of attribute immediate.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def immediate @immediate end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def logger @logger end |
#num_workers ⇒ Object
Returns the value of attribute num_workers.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def num_workers @num_workers end |
#persistence_store ⇒ Object
Returns the value of attribute persistence_store.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def persistence_store @persistence_store end |
#socket_location ⇒ Object
Returns the value of attribute socket_location.
3 4 5 |
# File 'lib/drb_queue/configuration.rb', line 3 def socket_location @socket_location end |
Instance Method Details
#after_fork(&block) ⇒ Object
32 33 34 |
# File 'lib/drb_queue/configuration.rb', line 32 def after_fork(&block) after_fork_callbacks << block end |
#after_fork_callbacks ⇒ Object
40 41 42 |
# File 'lib/drb_queue/configuration.rb', line 40 def after_fork_callbacks @after_fork_callbacks ||= [] end |
#before_fork(&block) ⇒ Object
36 37 38 |
# File 'lib/drb_queue/configuration.rb', line 36 def before_fork(&block) before_fork_callbacks << block end |
#before_fork_callbacks ⇒ Object
44 45 46 |
# File 'lib/drb_queue/configuration.rb', line 44 def before_fork_callbacks @before_fork_callbacks ||= [] end |
#construct_persistence_store ⇒ Object
18 19 20 21 22 |
# File 'lib/drb_queue/configuration.rb', line 18 def construct_persistence_store return unless persistence_store persistence_store[0].new(persistence_store[1]) end |
#immediate! ⇒ Object
24 25 26 |
# File 'lib/drb_queue/configuration.rb', line 24 def immediate! self.immediate = true end |
#on_error(&block) ⇒ Object
28 29 30 |
# File 'lib/drb_queue/configuration.rb', line 28 def on_error(&block) self.error_handler = block end |
#server_uri ⇒ Object
48 49 50 |
# File 'lib/drb_queue/configuration.rb', line 48 def server_uri "drbunix:#{socket_location}" end |