make WaitWritable and WaitReadable symbols
[kgio.git] / lib / kgio.rb
blob2ff366e09ac67f40c17f357ab5b8f384b4afbf32
1 # -*- encoding: binary -*-
2 require 'socket'
3 module Kgio
5   # The IPv4 address of UNIX domain sockets, useful for creating
6   # Rack (and CGI) servers that also serve HTTP traffic over
7   # UNIX domain sockets.
8   LOCALHOST = '127.0.0.1'
10   # Kgio::PipeMethods#kgio_tryread and Kgio::SocketMethods#kgio_tryread will
11   # return this constant when waiting for a read is required.
12   WaitReadable = :wait_readable
14   # PipeMethods#kgio_trywrite and SocketMethods#kgio_trywrite will
15   # return this constant when waiting for a read is required.
16   WaitWritable = :wait_writable
17 end
19 require 'kgio_ext'
21 # use Kgio::Pipe.popen and Kgio::Pipe.new instead of IO.popen
22 # and IO.pipe to get PipeMethods#kgio_read and PipeMethod#kgio_write
23 # methods.
24 class Kgio::Pipe < IO
25   include Kgio::PipeMethods
26   class << self
28     # call-seq:
29     #
30     #   rd, wr = Kgio::Pipe.new
31     #
32     # This creates a new pipe(7) with Kgio::Pipe objects that respond
33     # to PipeMethods#kgio_read and PipeMethod#kgio_write
34     alias new pipe
35   end
36 end