Class: WarningSigns::MessageFormatterList
- Inherits:
-
Object
- Object
- WarningSigns::MessageFormatterList
- Includes:
- Enumerable
- Defined in:
- lib/warning_signs/message_formatter_list.rb
Instance Attribute Summary collapse
-
#message_formatters ⇒ Object
readonly
Returns the value of attribute message_formatters.
Instance Method Summary collapse
- #behavior_match(behavior) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(message_formatters: [], message_formatter: nil) ⇒ MessageFormatterList
constructor
A new instance of MessageFormatterList.
Constructor Details
#initialize(message_formatters: [], message_formatter: nil) ⇒ MessageFormatterList
Returns a new instance of MessageFormatterList.
7 8 9 10 11 12 |
# File 'lib/warning_signs/message_formatter_list.rb', line 7 def initialize(message_formatters: [], message_formatter: nil) @message_formatters = .map do MessageFormatter::Base.for(**_1) end @message_formatters << MessageFormatter::Base.for(**) if end |
Instance Attribute Details
#message_formatters ⇒ Object (readonly)
Returns the value of attribute message_formatters.
5 6 7 |
# File 'lib/warning_signs/message_formatter_list.rb', line 5 def @message_formatters end |
Instance Method Details
#behavior_match(behavior) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/warning_signs/message_formatter_list.rb', line 18 def behavior_match(behavior) .find do _1.behaviors.only_except_match?(behavior) && _1.environments.only_except_match?(Rails.env) end end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/warning_signs/message_formatter_list.rb', line 14 def each(&block) .each(&block) end |