Class: NREPL::FakeStdout
- Inherits:
-
Object
- Object
- NREPL::FakeStdout
- Defined in:
- lib/nrepl/fake_stdout.rb
Instance Method Summary collapse
- #<<(text) ⇒ Object
- #close ⇒ Object
- #flush ⇒ Object
-
#initialize(connections, io, kind) ⇒ FakeStdout
constructor
A new instance of FakeStdout.
- #print(text) ⇒ Object
- #puts(text) ⇒ Object
- #sync ⇒ Object
- #sync=(val) ⇒ Object
- #write(text) ⇒ Object
Constructor Details
#initialize(connections, io, kind) ⇒ FakeStdout
Returns a new instance of FakeStdout.
3 4 5 6 7 |
# File 'lib/nrepl/fake_stdout.rb', line 3 def initialize(connections, io, kind) @connections = connections @io = io @kind = kind end |
Instance Method Details
#<<(text) ⇒ Object
9 10 11 |
# File 'lib/nrepl/fake_stdout.rb', line 9 def <<(text) print(text) end |
#close ⇒ Object
34 35 36 |
# File 'lib/nrepl/fake_stdout.rb', line 34 def close @io.close end |
#flush ⇒ Object
30 31 32 |
# File 'lib/nrepl/fake_stdout.rb', line 30 def flush @io.flush end |
#print(text) ⇒ Object
13 14 15 |
# File 'lib/nrepl/fake_stdout.rb', line 13 def print(text) write(text.to_s) end |
#puts(text) ⇒ Object
17 18 19 |
# File 'lib/nrepl/fake_stdout.rb', line 17 def puts(text) write("#{text}\n") end |
#sync ⇒ Object
38 39 40 |
# File 'lib/nrepl/fake_stdout.rb', line 38 def sync @io.sync end |
#sync=(val) ⇒ Object
42 43 44 |
# File 'lib/nrepl/fake_stdout.rb', line 42 def sync=(val) @io.sync = val end |
#write(text) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/nrepl/fake_stdout.rb', line 21 def write(text) @io.write(text) @connections.each do |conn| conn.send_msg( @kind => text ) end end |