Class: Nitrous::ProgressBarAwareStandardOut

Inherits:
Object
  • Object
show all
Defined in:
lib/nitrous/progress_bar.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout, progress_bar) ⇒ ProgressBarAwareStandardOut

Returns a new instance of ProgressBarAwareStandardOut.



11
12
13
# File 'lib/nitrous/progress_bar.rb', line 11

def initialize(stdout, progress_bar)
  @stdout, @progress_bar = stdout, progress_bar
end

Instance Method Details

#direct_write(object) ⇒ Object



33
34
35
# File 'lib/nitrous/progress_bar.rb', line 33

def direct_write(object)
  @stdout.write(object)
end


21
22
23
24
25
# File 'lib/nitrous/progress_bar.rb', line 21

def print(*args)
  args.each do |arg|
    write(arg)
  end
end

#puts(*args) ⇒ Object



27
28
29
30
31
# File 'lib/nitrous/progress_bar.rb', line 27

def puts(*args)
  args.each do |arg|
    write("#{arg}\n")
  end
end

#write(object) ⇒ Object



15
16
17
18
19
# File 'lib/nitrous/progress_bar.rb', line 15

def write(object)
  @progress_bar.delete_bar
  @stdout.write(object)
  @progress_bar.redraw_bar
end