remove autopush support and make it a no-op
[kgio.git] / lib / kgio.rb
blobf19207451d3643cdbe58f1a7444caa946acdb447
1 # -*- encoding: binary -*-
2 require 'socket'
4 # See the {README}[link:index.html]
5 module Kgio
7   # The IPv4 address of UNIX domain sockets, useful for creating
8   # Rack (and CGI) servers that also serve HTTP traffic over
9   # UNIX domain sockets.
10   LOCALHOST = '127.0.0.1'
12   # Kgio::PipeMethods#kgio_tryread and Kgio::SocketMethods#kgio_tryread will
13   # return :wait_readable when waiting for a read is required.
14   WaitReadable = :wait_readable
16   # PipeMethods#kgio_trywrite and SocketMethods#kgio_trywrite will return
17   # :wait_writable when waiting for a read is required.
18   WaitWritable = :wait_writable
20   # autopush is no-op nowadays
21   @autopush = false
23   class << self
24     attr_accessor :autopush # :nodoc:
25     def autopush? # :nodoc:
26       !!@autopush
27     end
28   end
29 end
31 require 'kgio_ext'
33 # use Kgio::Pipe.popen and Kgio::Pipe.new instead of IO.popen
34 # and IO.pipe to get PipeMethods#kgio_read and PipeMethod#kgio_write
35 # methods.
36 class Kgio::Pipe < IO
37   include Kgio::PipeMethods
38   class << self
40     # call-seq:
41     #
42     #   rd, wr = Kgio::Pipe.new
43     #
44     # This creates a new pipe(7) with Kgio::Pipe objects that respond
45     # to PipeMethods#kgio_read and PipeMethod#kgio_write
46     alias new pipe
47   end
48 end