lib/progress/class_methods.rb in progress-3.2.2 vs lib/progress/class_methods.rb in progress-3.3.0

- old
+ new

@@ -90,10 +90,20 @@ # explicitly set showing progress in terminal title [true/false/nil] def terminal_title=(value) @terminal_title = true && value end + attr_writer :io + + def io + @io ||= $stderr + end + + def io_tty? + io.tty? || ENV['PROGRESS_TTY'] + end + private attr_reader :eta def init(total = nil, title = nil) @@ -123,17 +133,9 @@ begin yield ensure @lock.unlock end - end - - def io - @io || $stderr - end - - def io_tty? - io.tty? || ENV['PROGRESS_TTY'] end def start_beeper @beeper = Beeper.new(10) do print_message