Class: Airbrussh::DelegatingFormatter
- Inherits:
-
Object
- Object
- Airbrussh::DelegatingFormatter
- Defined in:
- lib/airbrussh/delegating_formatter.rb
Overview
This class quacks like an SSHKit::Formatter, but when any formatting methods are called, it simply forwards them to one more more concrete formatters. This allows us to split out the responsibilities of ConsoleFormatter and LogFileFormatter into two separate classes, with DelegatingFormatter forwarding the logging messages to both at once.
Direct Known Subclasses
Constant Summary collapse
- FORWARD_METHODS =
%w[ fatal error warn info debug log log_command_start log_command_data log_command_exit ].freeze
- DUP_AND_FORWARD_METHODS =
%w[<< write].freeze
Instance Attribute Summary collapse
-
#formatters ⇒ Object
readonly
Returns the value of attribute formatters.
Instance Method Summary collapse
-
#initialize(formatters) ⇒ DelegatingFormatter
constructor
A new instance of DelegatingFormatter.
Constructor Details
#initialize(formatters) ⇒ DelegatingFormatter
Returns a new instance of DelegatingFormatter.
19 20 21 |
# File 'lib/airbrussh/delegating_formatter.rb', line 19 def initialize(formatters) @formatters = formatters end |
Instance Attribute Details
#formatters ⇒ Object (readonly)
Returns the value of attribute formatters.
17 18 19 |
# File 'lib/airbrussh/delegating_formatter.rb', line 17 def formatters @formatters end |