Class: Consumer::Controls::Get::Incrementing
- Inherits:
-
Object
- Object
- Consumer::Controls::Get::Incrementing
show all
- Includes:
- Configure, Initializer
- Defined in:
- lib/consumer/controls/get/incrementing.rb
Defined Under Namespace
Modules: Defaults
Classes: MessageData
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#frequency_milliseconds ⇒ Object
10
11
12
|
# File 'lib/consumer/controls/get/incrementing.rb', line 10
def frequency_milliseconds
@frequency_milliseconds ||= Defaults.frequency_milliseconds
end
|
Class Method Details
.build(frequency_milliseconds = nil) ⇒ Object
19
20
21
22
23
|
# File 'lib/consumer/controls/get/incrementing.rb', line 19
def self.build(frequency_milliseconds=nil)
instance = new
instance.frequency_milliseconds = frequency_milliseconds
instance
end
|
Instance Method Details
#batch_size ⇒ Object
29
30
31
|
# File 'lib/consumer/controls/get/incrementing.rb', line 29
def batch_size
Defaults.batch_size
end
|
#call(position) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/consumer/controls/get/incrementing.rb', line 33
def call(position)
position ||= 0
sleep(frequency_seconds)
batch_size.times.map do |offset|
MessageData.example(
position + offset,
offset
)
end
end
|
#category ⇒ Object
25
26
27
|
# File 'lib/consumer/controls/get/incrementing.rb', line 25
def category
Category.example
end
|
#frequency_seconds ⇒ Object
15
16
17
|
# File 'lib/consumer/controls/get/incrementing.rb', line 15
def frequency_seconds
frequency_milliseconds.to_f / 1000
end
|