Returns true
if file_name
is an absolute path, and false
otherwise.
File.absolute_path?("c:/foo") #=> false (on Linux), true (on Windows)
Returns the pathname used to create file as a string. Does not normalize the name.
The pathname may not point to the file corresponding to file. For instance, the pathname becomes void when the file has been moved or deleted.
This method raises IOError
for a file created using File::Constants::TMPFILE because they don’t have a pathname.
File.new("testfile").path #=> "testfile" File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx"
Returns the list of available encoding names.
Encoding.name_list #=> ["US-ASCII", "ASCII-8BIT", "UTF-8", "ISO-8859-1", "Shift_JIS", "EUC-JP", "Windows-31J", "BINARY", "CP932", "eucJP"]
Returns a hash representing information about named captures of rxp.
A key of the hash is a name of the named captures. A value of the hash is an array which is list of indexes of corresponding named captures.
/(?<foo>.)(?<bar>.)/.named_captures #=> {"foo"=>[1], "bar"=>[2]} /(?<foo>.)(?<foo>.)/.named_captures #=> {"foo"=>[1, 2]}
If there are no named captures, an empty hash is returned.
/(.)(.)/.named_captures #=> {}
Returns the socket path as a string.
Addrinfo.unix("/tmp/sock").unix_path #=> "/tmp/sock"
Returns library name. If the method fails to access library name, WIN32OLERuntimeError
is raised.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') tlib.library_name # => Excel
Set
date-time format.
datetime_format
A string suitable for passing to strftime
.
Returns the date format being used. See datetime_format=
Returns a Hash
using named capture.
A key of the hash is a name of the named captures. A value of the hash is a string of last successful capture of corresponding group.
m = /(?<a>.)(?<b>.)/.match("01") m.named_captures #=> {"a" => "0", "b" => "1"} m = /(?<a>.)(?<b>.)?/.match("0") m.named_captures #=> {"a" => "0", "b" => nil} m = /(?<a>.)(?<a>.)/.match("01") m.named_captures #=> {"a" => "1"} m = /(?<a>x)|(?<a>y)/.match("x") m.named_captures #=> {"a" => "x"}
Ensures that names
only includes names for the :rdoc, :clobber_rdoc and :rerdoc. If other names are given an ArgumentError
is raised.
Iterates over all hostnames for address
.
Iterates over all hostnames for address
.
Find
the full path to the executable for gem name
. If the exec_name
is not given, an exception will be raised, otherwise the specified executable’s path is returned. requirements
allows you to specify specific gem versions.
Reset the dir
and path
values. The next time dir
or path
is requested, the values will be calculated from scratch. This is mainly used by the unit tests to provide test isolation.
Use the home
and paths
values for Gem.dir
and Gem.path
. Used mainly by the unit tests to provide environment isolation.
Default gem load path
Prefix and suffix the program filename the same as ruby.
Returns the destination encoding name as a string.
Returns the destination encoding name as a string.
Return the list of all instance variables.
Merges a base path base
, with relative path rel
, returns a modified base path.
Returns the name of the cipher which may differ slightly from the original name provided.
Returns the sn of this Digest
algorithm.
digest = OpenSSL::Digest.new('SHA512') puts digest.name # => SHA512