Object
add padding to the left of an action that was performed.
# File lib/compass/logger.rb, line 120 def action_padding(action) ' ' * [(max_action_length - action.to_s.length), 0].max end
# File lib/compass/logger.rb, line 95 def color(c) if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym) if defined?($boring) && $boring "" else "\e[#{COLORS[c.to_sym]}m" end else "" end end
Emit a log message without a trailing newline
# File lib/compass/logger.rb, line 108 def emit(msg) print msg $stdout.flush end
# File lib/compass/logger.rb, line 73 def green wrap(:green) { yield } end
Emit a log message with a trailing newline
# File lib/compass/logger.rb, line 114 def log(msg) puts msg $stdout.flush end
the maximum length of all the actions known to the logger.
# File lib/compass/logger.rb, line 125 def max_action_length @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max} end
Record an action that has occurred
# File lib/compass/logger.rb, line 60 def record(action, *arguments) return if options[:quiet] && ACTION_CAN_BE_QUIET[action] msg = "" if time msg << Time.now.strftime("%I:%M:%S.%3N %p") end msg << color(ACTION_COLORS[action]) if Compass.configuration.color_output msg << "#{action_padding(action)}#{action}" msg << color(:clear) if Compass.configuration.color_output msg << " #{arguments.join(' ')}" log msg end
Generated with the Darkfish Rdoc Generator 2.