class Object
Public Instance Methods
info(message, color: :black)
click to toggle source
Issue an informational message.
@param message [String] informational message
# File lib/core_ext/object.rb 32 def info(message, color: :black) 33 puts message.send(color) 34 end
verbose_info(message, color: :blue)
click to toggle source
Issue a verbose informational message.
@param message [String] verbose informational message
# File lib/core_ext/object.rb 39 def verbose_info(message, color: :blue) 40 info(message, color: color) if $VERBOSE_INFO 41 end
warn(message, pry: nil)
click to toggle source
Issue a warning and maybe open a Pry session attached to the error or binding passed.
@example with error context
begin (...) rescue => error warn("oops", pry: error) end
@example with binding context
warn("oops", pry: binding)
@param message [String] warning message @param pry [Exception, Binding, nil] attach the Pry session to this error
or binding
# File lib/core_ext/object.rb 18 def warn(message, pry: nil) 19 $WARN_COUNTER = $WARN_COUNTER.to_i + 1 20 Kernel.warn "WARNING #{$WARN_COUNTER}: #{message}".red 21 if $PRY_ON_WARN == true || $PRY_ON_WARN == $WARN_COUNTER 22 case pry 23 when Exception then Pry::rescued(pry) 24 when Binding then pry.pry 25 end 26 end 27 end