Class: Disqualified::ServerConfiguration
- Inherits:
-
Object
- Object
- Disqualified::ServerConfiguration
- Defined in:
- lib/disqualified/configuration_structs.rb
Instance Attribute Summary collapse
-
#delay_high ⇒ Object
Returns the value of attribute delay_high.
-
#delay_low ⇒ Object
Returns the value of attribute delay_low.
-
#error_hooks ⇒ Object
readonly
Returns the value of attribute error_hooks.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#pool_size ⇒ Object
Returns the value of attribute pool_size.
-
#pwd ⇒ Object
Returns the value of attribute pwd.
Instance Method Summary collapse
- #delay_range ⇒ Object
-
#initialize ⇒ ServerConfiguration
constructor
A new instance of ServerConfiguration.
- #on_error(&block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ ServerConfiguration
Returns a new instance of ServerConfiguration.
10 11 12 13 14 15 16 17 |
# File 'lib/disqualified/configuration_structs.rb', line 10 def initialize @delay_high = 5.0 @delay_low = 1.0 @logger = Rails.logger @pool_size = 5 @pwd = Dir.pwd @error_hooks = [] end |
Instance Attribute Details
#delay_high ⇒ Object
Returns the value of attribute delay_high.
19 20 21 |
# File 'lib/disqualified/configuration_structs.rb', line 19 def delay_high @delay_high end |
#delay_low ⇒ Object
Returns the value of attribute delay_low.
21 22 23 |
# File 'lib/disqualified/configuration_structs.rb', line 21 def delay_low @delay_low end |
#error_hooks ⇒ Object
Returns the value of attribute error_hooks.
23 24 25 |
# File 'lib/disqualified/configuration_structs.rb', line 23 def error_hooks @error_hooks end |
#logger ⇒ Object
Returns the value of attribute logger.
25 26 27 |
# File 'lib/disqualified/configuration_structs.rb', line 25 def logger @logger end |
#pool_size ⇒ Object
Returns the value of attribute pool_size.
27 28 29 |
# File 'lib/disqualified/configuration_structs.rb', line 27 def pool_size @pool_size end |
#pwd ⇒ Object
Returns the value of attribute pwd.
29 30 31 |
# File 'lib/disqualified/configuration_structs.rb', line 29 def pwd @pwd end |
Instance Method Details
#delay_range ⇒ Object
33 34 35 |
# File 'lib/disqualified/configuration_structs.rb', line 33 def delay_range delay_low.to_f..delay_high.to_f end |
#on_error(&block) ⇒ Object
37 38 39 |
# File 'lib/disqualified/configuration_structs.rb', line 37 def on_error(&block) error_hooks.push(block) end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/disqualified/configuration_structs.rb', line 41 def to_s "{ delay: #{delay_range}, pool_size: #{pool_size}, error_hooks_size: #{error_hooks.size} }" end |