Class: Synvert::Core::Rewriter::Warning

Inherits:
Object
  • Object
show all
Defined in:
lib/synvert/core/rewriter/warning.rb

Overview

Warning is used to save warning message.

Instance Method Summary collapse

Constructor Details

#initialize(instance, message) ⇒ Warning

Initialize a warning.

Parameters:


10
11
12
13
14
# File 'lib/synvert/core/rewriter/warning.rb', line 10

def initialize(instance, message)
  @file_path = instance.current_file
  @line = instance.current_node.loc.expression.line
  @message = message
end

Instance Method Details

#messageString

Warning message.

Returns:

  • (String)

    warning message.


19
20
21
# File 'lib/synvert/core/rewriter/warning.rb', line 19

def message
  "#{@file_path}##{@line}: #{@message}"
end