Module: RSMP::Collector::Reporting
- Included in:
- RSMP::Collector
- Defined in:
- lib/rsmp/collect/collector/reporting.rb
Overview
Progress reporting and description methods for collectors
Instance Method Summary collapse
-
#describe_matcher ⇒ Object
return a string that describes the attributes that we’re looking for.
-
#describe_num_and_type ⇒ Object
return a string that describes whe number of messages, and type of message we’re collecting.
-
#describe_progress ⇒ Object
Build a string describing how far progress reached before timeout.
-
#describe_types ⇒ Object
return a string describing the types of messages we’re collecting.
-
#identifier ⇒ Object
get a short id in hex format, identifying ourself.
Instance Method Details
#describe_matcher ⇒ Object
return a string that describes the attributes that we’re looking for
20 21 22 23 24 25 26 27 |
# File 'lib/rsmp/collect/collector/reporting.rb', line 20 def describe_matcher h = { component: @filter&.component }.compact if h.empty? describe_num_and_type else "#{describe_num_and_type} #{h}" end end |
#describe_num_and_type ⇒ Object
return a string that describes whe number of messages, and type of message we’re collecting
11 12 13 14 15 16 17 |
# File 'lib/rsmp/collect/collector/reporting.rb', line 11 def describe_num_and_type if @num && @num > 1 "#{@num} #{describe_types}s" else describe_types end end |
#describe_progress ⇒ Object
Build a string describing how far progress reached before timeout
30 31 32 33 34 35 36 |
# File 'lib/rsmp/collect/collector/reporting.rb', line 30 def describe_progress str = "#{@title.capitalize} #{identifier} " str << "in response to #{@m_id} " if @m_id str << "timed out after #{@timeout}s, " str << "reaching #{@messages.size}/#{@num}" str end |
#describe_types ⇒ Object
return a string describing the types of messages we’re collecting
6 7 8 |
# File 'lib/rsmp/collect/collector/reporting.rb', line 6 def describe_types [@filter&.type].flatten.join('/') end |
#identifier ⇒ Object
get a short id in hex format, identifying ourself
39 40 41 |
# File 'lib/rsmp/collect/collector/reporting.rb', line 39 def identifier "Collect #{object_id.to_s(16)}" end |