Class: GemSuit::CLI::Application::IOBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_suit/cli/application/io_buffer.rb

Defined Under Namespace

Classes: BufferData

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.capture(&block) ⇒ Object



6
7
8
# File 'lib/gem_suit/cli/application/io_buffer.rb', line 6

def self.capture(&block)
  self.new.capture &block
end

Instance Method Details

#capture(&block) ⇒ Object



10
11
12
13
14
15
# File 'lib/gem_suit/cli/application/io_buffer.rb', line 10

def capture(&block)
  @data = nil
  data.record do
    yield self
  end
end

#execute(command) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/gem_suit/cli/application/io_buffer.rb', line 21

def execute(command)
  IO.popen(command) do |io|
    until io.eof?
      puts (data << io.gets).last
    end
  end
end

#log(line) ⇒ Object



17
18
19
# File 'lib/gem_suit/cli/application/io_buffer.rb', line 17

def log(line)
  data << "GemSuit: #{line}"
end