Class: ShellWriter
- Inherits:
-
Object
- Object
- ShellWriter
- Defined in:
- lib/shell-proxy/shell_writer.rb
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(to) ⇒ ShellWriter
constructor
A new instance of ShellWriter.
- #puts(str) ⇒ Object
- #write(str) ⇒ Object
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
#flush ⇒ Object
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 |