Is it possible for me to have output that go to the $stdout go through a
method instead? ie:
Have stuff go through this:
def write_to(str)
@socket.send(str, 0)
end
?
Is it possible for me to have output that go to the $stdout go through a
method instead? ie:
Have stuff go through this:
def write_to(str)
@socket.send(str, 0)
end
?
On Mar 9, 2009, at 17:35, Tim M. wrote:
Is it possible for me to have output that go to the $stdout go
through a
method instead? ie:Have stuff go through this:
def write_to(str)
@socket.send(str, 0)
end
You can assign any object that responds to #write to $stdout.
See also:
http://blog.segment7.net/articles/2006/08/17/stdout-vs-stdout
2009/3/10 Eric H. [email protected]:
You can assign any object that responds to #write to $stdout.
See also:
http://blog.segment7.net/articles/2006/08/17/stdout-vs-stdout
In this case IO#reopen seems more appropriate IMHO (if it works with
Sockets, which I did not verify). It’s faster (no Ruby code needed)
and will also work for sub processes.
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs