Class: ShellWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/shell-proxy/shell_writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(to) ⇒ ShellWriter

Returns a new instance of ShellWriter.



2
3
4
5
6
7
8
9
10
11
# File 'lib/shell-proxy/shell_writer.rb', line 2

def initialize(to)
  case to
  when String
    @to = File.open(to)
  when IO
    @to = to
  else
    raise "I don't know what to do"
  end
end

Instance Method Details

#flushObject



21
22
23
# File 'lib/shell-proxy/shell_writer.rb', line 21

def flush
  @to.flush
end

#puts(str) ⇒ Object



17
18
19
# File 'lib/shell-proxy/shell_writer.rb', line 17

def puts(str)
  @to.puts(str)
end

#write(str) ⇒ Object



13
14
15
# File 'lib/shell-proxy/shell_writer.rb', line 13

def write(str)
  @to.write(str)
end