Class: Disqualified::ServerConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/disqualified/configuration_structs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServerConfiguration

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_highObject

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_lowObject

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_hooksObject

Returns the value of attribute error_hooks.



23
24
25
# File 'lib/disqualified/configuration_structs.rb', line 23

def error_hooks
  @error_hooks
end

#loggerObject

Returns the value of attribute logger.



25
26
27
# File 'lib/disqualified/configuration_structs.rb', line 25

def logger
  @logger
end

#pool_sizeObject

Returns the value of attribute pool_size.



27
28
29
# File 'lib/disqualified/configuration_structs.rb', line 27

def pool_size
  @pool_size
end

#pwdObject

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_rangeObject



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_sObject



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