Heading banner preceding summary.
Version
Returns version string from program_name
, version and release.
Parses command line arguments argv
in order. When a block is given, each non-option argument is yielded. When optional into
keyword argument is provided, the parsed option values are stored there via []=
method (so it can be Hash
, or OpenStruct
, or other similar object).
Returns the rest of argv
left unparsed.
Same as order
, but removes switches destructively. Non-option arguments remain in argv
.
Parses command line arguments argv
in permutation mode and returns list of non-option arguments. When optional into
keyword argument is provided, the parsed option values are stored there via []=
method (so it can be Hash
, or OpenStruct
, or other similar object).
Same as permute
, but removes switches destructively. Non-option arguments remain in argv
.
Wrapper method for getopts.rb.
params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option") # params["a"] = true # -a # params["b"] = "1" # -b1 # params["foo"] = "1" # --foo # params["bar"] = "x" # --bar x # params["zot"] = "z" # --zot Z
Loads options from file names as filename
. Does nothing when the file is not present. Returns whether successfully loaded.
filename
defaults to basename of the program without suffix in a directory ~/.options, then the basename with ‘.options’ suffix under XDG and Haiku standard places.
Looks up the first IP address for name
.
Looks up all IP address for name
.
Looks up the hostname of address
.
Looks up all hostnames for address
.
Looks up the first IP address for name
.
Looks up all IP address for name
.
Looks up the hostname of address
.
Looks up all hostnames for address
.
Closes the file. If unlink_now
is true, then the file will be unlinked (deleted) after closing. Of course, you can choose to later call unlink
if you do not unlink it now.
If you don’t explicitly unlink the temporary file, the removal will be delayed until the object is finalized.
Closes and unlinks (deletes) the file. Has the same effect as called close(true)
.
Returns the parameter information of this proc.
prc = lambda{|x, y=42, *other|} prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
Returns a clone of this method.
class A def foo return "bar" end end m = A.new.method(:foo) m.call # => "bar" n = m.clone.call # => "bar"
Returns the bound receiver of the method object.
(1..3).method(:map).receiver # => 1..3
Returns the class or module that defines the method. See also Method#receiver
.
(1..3).method(:map).owner #=> Enumerable