Class: Vendorificator::IOProxy

Inherits:
StringIO
  • Object
show all
Defined in:
lib/vendorificator/io_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell, verbosity = :default) ⇒ IOProxy

Returns a new instance of IOProxy.



7
8
9
10
11
12
13
# File 'lib/vendorificator/io_proxy.rb', line 7

def initialize(shell, verbosity = :default)
  @shell = shell
  @verbosity = verbosity

  super()
  capture_stdout
end

Instance Attribute Details

#shellObject (readonly)

Returns the value of attribute shell.



5
6
7
# File 'lib/vendorificator/io_proxy.rb', line 5

def shell
  @shell
end

Instance Method Details

#puts(value, verb_level = :default) ⇒ Object



15
16
17
18
# File 'lib/vendorificator/io_proxy.rb', line 15

def puts(value, verb_level = :default)
  @orig_stdout.puts value if should_speak?(verb_level)
  super
end

#say(verb_level, *args) ⇒ Object



25
26
27
28
# File 'lib/vendorificator/io_proxy.rb', line 25

def say(verb_level, *args)
  write args[0]
  @shell.say(*args) if @shell && should_speak?(verb_level)
end

#say_status(verb_level, *args) ⇒ Object



20
21
22
23
# File 'lib/vendorificator/io_proxy.rb', line 20

def say_status(verb_level, *args)
  write args[0..1].join('  ' * @shell.padding)
  @shell.say_status(*args) if @shell && should_speak?(verb_level)
end