Class: Warder::CoffeeLintRunner::MessageLineFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/warder/coffee_lint_runner/message_line_formatter.rb

Overview

responsible for human readable error message representation

Constant Summary collapse

MESSAGE_KEY =
'message'.freeze
CONTEXT_KEY =
'context'.freeze
LEVEL_KEY =
'level'.freeze
LINE_NUMBER_KEY =
'lineNumber'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ MessageLineFormatter

Returns a new instance of MessageLineFormatter.



11
12
13
# File 'lib/warder/coffee_lint_runner/message_line_formatter.rb', line 11

def initialize(result)
  @result = result
end

Instance Method Details

#formatObject



15
16
17
18
# File 'lib/warder/coffee_lint_runner/message_line_formatter.rb', line 15

def format
  msg = [@result[MESSAGE_KEY], @result[CONTEXT_KEY]].join('. ')
  [level, line_number, msg].join(': ')
end