Class: Lhm::Throttler::Time

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/lhm/throttler/time.rb

Direct Known Subclasses

LegacyTime

Constant Summary collapse

DEFAULT_TIMEOUT =
0.1
DEFAULT_STRIDE =
40_000

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Command

#run

Constructor Details

#initialize(options = {}) ⇒ Time

Returns a new instance of Time.



12
13
14
15
# File 'lib/lhm/throttler/time.rb', line 12

def initialize(options = {})
  @timeout_seconds = options[:delay] || DEFAULT_TIMEOUT
  @stride = options[:stride] || DEFAULT_STRIDE
end

Instance Attribute Details

#strideObject

Returns the value of attribute stride.



10
11
12
# File 'lib/lhm/throttler/time.rb', line 10

def stride
  @stride
end

#timeout_secondsObject

Returns the value of attribute timeout_seconds.



9
10
11
# File 'lib/lhm/throttler/time.rb', line 9

def timeout_seconds
  @timeout_seconds
end

Instance Method Details

#executeObject



17
18
19
# File 'lib/lhm/throttler/time.rb', line 17

def execute
  sleep timeout_seconds
end