Class: NREPL::FakeStdout
- Inherits:
-
Object
show all
- Defined in:
- lib/nrepl/fake_stdout.rb
Instance Method Summary
collapse
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
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
24
25
26
|
# File 'lib/nrepl/fake_stdout.rb', line 24
def method_missing(method, *args)
@io.send(method, *args)
end
|
Instance Method Details
#<<(text) ⇒ Object
9
10
11
12
|
# File 'lib/nrepl/fake_stdout.rb', line 9
def <<(text)
print(text)
nil
end
|
#close ⇒ Object
41
42
43
|
# File 'lib/nrepl/fake_stdout.rb', line 41
def close
@io.close
end
|
#flush ⇒ Object
37
38
39
|
# File 'lib/nrepl/fake_stdout.rb', line 37
def flush
@io.flush
end
|
#print(text) ⇒ Object
14
15
16
17
|
# File 'lib/nrepl/fake_stdout.rb', line 14
def print(text)
write(text.to_s)
nil
end
|
#puts(text) ⇒ Object
19
20
21
22
|
# File 'lib/nrepl/fake_stdout.rb', line 19
def puts(text)
write("#{text}\n")
nil
end
|
#sync ⇒ Object
45
46
47
|
# File 'lib/nrepl/fake_stdout.rb', line 45
def sync
@io.sync
end
|
#sync=(val) ⇒ Object
49
50
51
|
# File 'lib/nrepl/fake_stdout.rb', line 49
def sync=(val)
@io.sync = val
end
|
#write(text) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/nrepl/fake_stdout.rb', line 28
def write(text)
@io.write(text)
@connections.each do |conn|
conn.send_msg(
@kind => text
)
end
end
|