Module: Console::Warn

Defined in:
lib/console/warn.rb

Overview

Redirect warnings to Console.warn.

Instance Method Summary collapse

Instance Method Details

#warn(message, **options) ⇒ Object

Redirect warnings to Console.warn.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/console/warn.rb', line 15

def warn(message, **options)
	fiber = Fiber.current
	
	# We do this to be extra pendantic about avoiding infinite recursion.
	return super if fiber.console_warn
	
	begin
		fiber.console_warn = true
		message.chomp!
		
		Console::Logger.instance.warn(message, **options)
	ensure
		fiber.console_warn = false
	end
end