Class: MyThreadOut
- Inherits:
-
Object
show all
- Defined in:
- lib/toaster/toaster_app_service.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/toaster/toaster_app_service.rb', line 38
def method_missing(name, *args, &block)
local_out = Thread.current[:stdout]
if local_out then
local_out.send(name, *args, &block)
else
STDOUT.send(name, *args, &block)
end
end
|
Instance Method Details
#flush ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/toaster/toaster_app_service.rb', line 30
def flush()
local_out = Thread.current[:stdout]
if local_out then
local_out.flush
else
STDOUT.flush
end
end
|
#write(out) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/toaster/toaster_app_service.rb', line 22
def write(out)
local_out = Thread.current[:stdout]
if local_out then
local_out.write out
else
STDOUT.write out
end
end
|