Class: ChatNotifier::FailureGroups
- Inherits:
-
Object
- Object
- ChatNotifier::FailureGroups
- Defined in:
- lib/chat_notifier/failure_groups.rb
Overview
Groups test failures by file and packs them into reasonably sized batches suitable for posting as individual Slack thread replies.
Instance Attribute Summary collapse
-
#char_limit ⇒ Object
readonly
Returns the value of attribute char_limit.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#group_size ⇒ Object
readonly
Returns the value of attribute group_size.
Instance Method Summary collapse
-
#initialize(failures, group_size: 10, char_limit: 3000) ⇒ FailureGroups
constructor
A new instance of FailureGroups.
-
#reply_texts ⇒ Object
One rendered string per thread reply: file blocks packed into batches bounded by group_size (file count) and char_limit (rendered length).
Constructor Details
#initialize(failures, group_size: 10, char_limit: 3000) ⇒ FailureGroups
Returns a new instance of FailureGroups.
7 8 9 10 11 |
# File 'lib/chat_notifier/failure_groups.rb', line 7 def initialize(failures, group_size: 10, char_limit: 3000) @failures = failures @group_size = group_size @char_limit = char_limit end |
Instance Attribute Details
#char_limit ⇒ Object (readonly)
Returns the value of attribute char_limit.
13 14 15 |
# File 'lib/chat_notifier/failure_groups.rb', line 13 def char_limit @char_limit end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
13 14 15 |
# File 'lib/chat_notifier/failure_groups.rb', line 13 def failures @failures end |
#group_size ⇒ Object (readonly)
Returns the value of attribute group_size.
13 14 15 |
# File 'lib/chat_notifier/failure_groups.rb', line 13 def group_size @group_size end |
Instance Method Details
#reply_texts ⇒ Object
One rendered string per thread reply: file blocks packed into batches bounded by group_size (file count) and char_limit (rendered length).
17 18 19 |
# File 'lib/chat_notifier/failure_groups.rb', line 17 def reply_texts batches.map { |blocks| blocks.join("\n") } end |