Class: NREPL::FakeStdout
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- NREPL::FakeStdout
- Defined in:
- lib/nrepl-lazuli/fake_stdout.rb
Instance Method Summary collapse
- #<<(text) ⇒ Object
-
#initialize(connections, io, kind) ⇒ FakeStdout
constructor
A new instance of FakeStdout.
- #print(*text) ⇒ Object
- #puts(*text) ⇒ Object
- #write(*texts) ⇒ Object
Constructor Details
#initialize(connections, io, kind) ⇒ FakeStdout
Returns a new instance of FakeStdout.
5 6 7 8 9 10 |
# File 'lib/nrepl-lazuli/fake_stdout.rb', line 5 def initialize(connections, io, kind) @connections = connections @io = io @kind = kind super(io) end |
Instance Method Details
#<<(text) ⇒ Object
12 13 14 15 |
# File 'lib/nrepl-lazuli/fake_stdout.rb', line 12 def <<(text) print(text) nil end |
#print(*text) ⇒ Object
17 18 19 20 |
# File 'lib/nrepl-lazuli/fake_stdout.rb', line 17 def print(*text) write(text.join('')) nil end |
#puts(*text) ⇒ Object
22 23 24 25 |
# File 'lib/nrepl-lazuli/fake_stdout.rb', line 22 def puts(*text) write("#{text.join("\n")}\n") nil end |
#write(*texts) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/nrepl-lazuli/fake_stdout.rb', line 27 def write(*texts) text = texts.join('') @connections.each do |conn| conn.send_msg( @kind => text ) end @io.write(text) end |