Returns true
if option processing has terminated, false
otherwise.
Returns the next option as a 2-element array containing:
The option name (the name itself, not an alias).
The option value.
Returns nil
if there are no more options.
Returns true if the ipaddr is a loopback address.
Returns a string for DNS reverse lookup. It returns a string in RFC3172 form for an IPv6 address.
Returns the bound receiver of the binding object.
Terminates option parsing. Optional parameter arg
is a string pushed back to be the first non-option argument.
Heading banner preceding summary.
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
Option symbolize_names
(boolean) specifies whether returned Hash
keys should be Symbols; defaults to false
(use Strings).
params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option", symbolize_names: true) # 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.
The optional into
keyword argument works exactly like that accepted in method parse
.
Returns an array of member names of the data class:
Measure = Data.define(:amount, :unit) Measure.members # => [:amount, :unit]
Returns the member names from self
as an array:
Measure = Data.define(:amount, :unit) distance = Measure[10, 'km'] distance.members #=> [:amount, :unit]
Returns the regexp that produced the match:
m = /a.*b/.match("abc") # => #<MatchData "ab"> m.regexp # => /a.*b/
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
.