lib/guard/ui.rb in guard-2.0.3 vs lib/guard/ui.rb in guard-2.0.4
- old
+ new
@@ -1,7 +1,8 @@
require 'lumberjack'
+require 'guard/options'
require 'guard/ui/colors'
module Guard
# The UI class helps to format messages for the user. Everything that is logged
@@ -18,12 +19,11 @@
# Get the Guard::UI logger instance
#
def logger
@logger ||= begin
- opts = options.marshal_dump
- Lumberjack::Logger.new(opts.delete(:device) { $stderr }, opts)
+ Lumberjack::Logger.new(options.fetch(:device) { $stderr }, options)
end
end
# Get the logger options
#
@@ -80,11 +80,11 @@
# @param [String] message the message to show
# @option options [Boolean] reset whether to clean the output before
# @option options [String] plugin manually define the calling plugin
#
def deprecation(message, options = {})
- warning(message, options) if ::Guard.options.show_deprecations
+ warning(message, options) if ::Guard.options[:show_deprecations]
end
# Show a debug message that is prefixed with DEBUG and a timestamp.
#
# @param [String] message the message to show
@@ -102,11 +102,11 @@
end
# Clear the output if clearable.
#
def clear(options = {})
- if ::Guard.options.clear && (@clearable || options[:force])
+ if ::Guard.options[:clear] && (@clearable || options[:force])
@clearable = false
system('clear;')
end
end
@@ -148,11 +148,11 @@
# @param [String] plugin the calling plugin name
# @yield When the message should be logged
# @yieldparam [String] param the calling plugin name
#
def _filter(plugin)
- only = options.only
- except = options.except
+ only = options[:only]
+ except = options[:except]
plugin = plugin || calling_plugin_name
if (!only && !except) || (only && only.match(plugin)) || (except && !except.match(plugin))
yield plugin
end