Class: QuietQuality::Cli::MessageFormatter
- Inherits:
-
Object
- Object
- QuietQuality::Cli::MessageFormatter
- Defined in:
- lib/quiet_quality/cli/message_formatter.rb
Constant Summary collapse
- TOKEN_MATCHING_REGEX =
%r{%[a-z]*-?\d+(?:tool|loc|level|path|lines|rule|body)}
Instance Method Summary collapse
- #format(message) ⇒ Object
-
#initialize(message_format:) ⇒ MessageFormatter
constructor
A new instance of MessageFormatter.
Constructor Details
#initialize(message_format:) ⇒ MessageFormatter
Returns a new instance of MessageFormatter.
6 7 8 |
# File 'lib/quiet_quality/cli/message_formatter.rb', line 6 def initialize(message_format:) @message_format = end |
Instance Method Details
#format(message) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/quiet_quality/cli/message_formatter.rb', line 10 def format() formatted_tokens = parsed_tokens.map { |pt| FormattedToken.new(parsed_token: pt, message: ) } formatted_tokens.reduce() do |interpolating, ftok| interpolating.gsub(ftok.token, ftok.formatted_token) end end |