Results for: "Pathname"

Returns the remote address of the socket as a sockaddr string.

TCPServer.open("127.0.0.1", 1440) {|serv|
  c = TCPSocket.new("127.0.0.1", 1440)
  s = serv.accept
  p s.getpeername #=> "\x02\x00\x82u\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
}

If Addrinfo object is preferred over the binary string, use BasicSocket#remote_address.

returns the canonical name as a string.

nil is returned if no canonical name.

The canonical name is set by Addrinfo.getaddrinfo when AI_CANONNAME is specified.

list = Addrinfo.getaddrinfo("www.ruby-lang.org", 80, :INET, :STREAM, nil, Socket::AI_CANONNAME)
p list[0] #=> #<Addrinfo: 221.186.184.68:80 TCP carbon.ruby-lang.org (www.ruby-lang.org)>
p list[0].canonname #=> "carbon.ruby-lang.org"

returns nodename and service as a pair of strings. This converts struct sockaddr in addrinfo to textual representation.

flags should be bitwise OR of Socket::NI_??? constants.

Addrinfo.tcp("127.0.0.1", 80).getnameinfo #=> ["localhost", "www"]

Addrinfo.tcp("127.0.0.1", 80).getnameinfo(Socket::NI_NUMERICSERV)
#=> ["localhost", "80"]

Returns the path of the local address of unixsocket.

s = UNIXServer.new("/tmp/sock")
p s.path #=> "/tmp/sock"

Returns the current filename. “-” is returned when the current file is STDIN.

For example:

$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark

$ ruby argf.rb foo bar glark

ARGF.filename  #=> "foo"
ARGF.read(5)   #=> "foo\nb"
ARGF.filename  #=> "bar"
ARGF.skip
ARGF.filename  #=> "glark"

Returns the current filename. “-” is returned when the current file is STDIN.

For example:

$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark

$ ruby argf.rb foo bar glark

ARGF.filename  #=> "foo"
ARGF.read(5)   #=> "foo\nb"
ARGF.filename  #=> "bar"
ARGF.skip
ARGF.filename  #=> "glark"

Returns an array of the capture names (see Named Captures):

m = /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge")
# => #<MatchData "hog" foo:"h" bar:"o" baz:"g">
m.names # => ["foo", "bar", "baz"]

m = /foo/.match('foo') # => #<MatchData "foo">
m.names # => [] # No named captures.

Equivalent to:

m = /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge")
m.regexp.names # => ["foo", "bar", "baz"]

Returns the string file path used to create the store:

store.path # => "flat.store"

Looks up the hostname of address.

Looks up all hostnames for address.

Looks up the hostname of address.

Looks up all hostnames for address.

Returns the full path name of the temporary file. This will be nil if unlink has been called.

Returns the parameter information of this proc. If the lambda keyword is provided and not nil, treats the proc as a lambda if true and as a non-lambda if false.

prc = proc{|x, y=42, *other|}
prc.parameters  #=> [[:opt, :x], [:opt, :y], [:rest, :other]]
prc = lambda{|x, y=42, *other|}
prc.parameters  #=> [[:req, :x], [:opt, :y], [:rest, :other]]
prc = proc{|x, y=42, *other|}
prc.parameters(lambda: true)  #=> [[:req, :x], [:opt, :y], [:rest, :other]]
prc = lambda{|x, y=42, *other|}
prc.parameters(lambda: false) #=> [[:opt, :x], [:opt, :y], [:rest, :other]]

Returns the name of the method.

Returns the parameter information of this method.

def foo(bar); end
method(:foo).parameters #=> [[:req, :bar]]

def foo(bar, baz, bat, &blk); end
method(:foo).parameters #=> [[:req, :bar], [:req, :baz], [:req, :bat], [:block, :blk]]

def foo(bar, *args); end
method(:foo).parameters #=> [[:req, :bar], [:rest, :args]]

def foo(bar, baz, *args, &blk); end
method(:foo).parameters #=> [[:req, :bar], [:req, :baz], [:rest, :args], [:block, :blk]]

Returns the name of the method.

Returns the parameter information of this method.

def foo(bar); end
method(:foo).parameters #=> [[:req, :bar]]

def foo(bar, baz, bat, &blk); end
method(:foo).parameters #=> [[:req, :bar], [:req, :baz], [:req, :bat], [:block, :blk]]

def foo(bar, *args); end
method(:foo).parameters #=> [[:req, :bar], [:rest, :args]]

def foo(bar, baz, *args, &blk); end
method(:foo).parameters #=> [[:req, :bar], [:req, :baz], [:rest, :args], [:block, :blk]]

The name set in Ractor.new, or nil.

show the name of the thread.

set given name to the ruby thread. On some platform, it may set the name to pthread and/or kernel.

Path of the file being run

Return the parameters definition of the method or block that the current hook belongs to. Format is the same as for Method#parameters

Returns the system information obtained by uname system call.

The return value is a hash which has 5 keys at least:

:sysname, :nodename, :release, :version, :machine

Example:

require 'etc'
require 'pp'

pp Etc.uname
#=> {:sysname=>"Linux",
#    :nodename=>"boron",
#    :release=>"2.6.18-6-xen-686",
#    :version=>"#1 SMP Thu Nov 5 19:54:42 UTC 2009",
#    :machine=>"i686"}

Retrieve the PathSupport object that RubyGems uses to lookup files.

Search took: 4ms  ·  Total Results: 3265