Module: Warning

Defined in:
lib/eturem/warning.rb

Class Method Summary collapse

Class Method Details

.warn(*message) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/eturem/warning.rb', line 2

def self.warn(*message)
  new_message = message.map do |mes|
    if mes.force_encoding("utf-8").match(/^(.+?):(\d+):\s*warning:\s*/)
      path, lineno, warning = $1, $2.to_i, $'.strip
      path = Eturem.program_name if path == File.expand_path(Eturem.program_name)
      str = Eturem::Base.warning_message(path, lineno, warning)
    end
    str || mes
  end
  super(*new_message)
end