lib/lll.rb in lll-1.12.3 vs lib/lll.rb in lll-1.13.0
- old
+ new
@@ -9,18 +9,19 @@
Lll.lll msg, block
end
module Lll
def self.lll msg, block = nil
+ using_dumb_terminal = ENV['TERM'] == 'dumb'
output_string = " "
expression_value = 0
if block
output_string << msg + ': ' if msg
expression_string = block.call
expression_value = eval(expression_string, block.binding)
output_string << expression_string + ' = '
- if defined?(AwesomePrint)
+ if defined?(AwesomePrint) && !using_dumb_terminal
output_string << expression_value.awesome_inspect << " \n"
elsif enumerable? expression_value
output_string << " \n"
expression_value.each { |e| output_string << ' ' << e.inspect << " \n" }
else
@@ -29,10 +30,10 @@
else
output_string << msg if msg
output_string << " \n"
end
- $stderr.puts format(output_string, ENV['TERM'] != 'dumb')
+ $stderr.puts format(output_string, !using_dumb_terminal)
Rails.logger.debug(format(output_string)) if defined?(Rails) && Rails.logger
expression_value
end