| Class | DRb::DRbUNIXSocket |
| In: |
drb/unix.rb
|
| Parent: | DRbTCPSocket |
| Max_try | = | 10 | import from tempfile.rb |
# File drb/unix.rb, line 56 def initialize(uri, soc, config={}, server_mode = false) super(uri, soc, config) set_sockopt(@socket) @server_mode = server_mode @acl = nil end
# File drb/unix.rb, line 21 def self.open(uri, config) filename, option = parse_uri(uri) filename.untaint soc = UNIXSocket.open(filename) self.new(uri, soc, config) end
# File drb/unix.rb, line 28 def self.open_server(uri, config) filename, option = parse_uri(uri) if filename.size == 0 soc = temp_server filename = soc.path uri = 'drbunix:' + soc.path else soc = UNIXServer.open(filename) end owner = config[:UNIXFileOwner] group = config[:UNIXFileGroup] if owner || group require 'etc' owner = Etc.getpwnam( owner ).uid if owner group = Etc.getgrnam( group ).gid if group File.chown owner, group, filename end mode = config[:UNIXFileMode] File.chmod(mode, filename) if mode self.new(uri, soc, config, true) end
# File drb/unix.rb, line 10 def self.parse_uri(uri) if /^drbunix:(.*?)(\?(.*))?$/ =~ uri filename = $1 option = $3 [filename, option] else raise(DRbBadScheme, uri) unless uri =~ /^drbunix:/ raise(DRbBadURI, 'can\'t parse uri:' + uri) end end
# File drb/unix.rb, line 51 def self.uri_option(uri, config) filename, option = parse_uri(uri) return "drbunix:#{filename}", option end
# File drb/unix.rb, line 89 def close return unless @socket path = @socket.path if @server_mode @socket.close File.unlink(path) if @server_mode @socket = nil end
ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.