Class: Vagrant::UI::Captured

Inherits:
Interface
  • Object
show all
Includes:
Util::SafePuts
Defined in:
lib/vagrant/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Captured

Returns a new instance of Captured.



14
15
16
17
18
# File 'lib/vagrant/dsl.rb', line 14

def initialize(resource)
  super
  @stdout = StringIO.new("", 'w+')
  @stderr = StringIO.new("", 'w+')
end

Instance Attribute Details

#stderrObject (readonly)

Returns the value of attribute stderr.



12
13
14
# File 'lib/vagrant/dsl.rb', line 12

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



11
12
13
# File 'lib/vagrant/dsl.rb', line 11

def stdout
  @stdout
end

Instance Method Details

#ask(*args) ⇒ Object

Raises:

  • (Errors::UIExpectsTTY)


20
21
22
23
# File 'lib/vagrant/dsl.rb', line 20

def ask(*args)
  super
  raise Errors::UIExpectsTTY
end

#say(type, message, opts = nil) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/vagrant/dsl.rb', line 34

def say(type, message, opts=nil)
  safe_puts(
    message,
    :io => type == :error ? @stderr : @stdout,
    :printer => :puts
  )
end