Returns true if the ipaddr is a link-local address. IPv4 addresses in 169.254.0.0/16 reserved by RFC 3927 and Link-Local IPv6 Unicast Addresses in fe80::/10 reserved by RFC 4291 are considered link-local.
Returns true if the ipaddr is an IPv4-mapped IPv6 address.
Returns a new ipaddr built by converting the native IPv4 address into an IPv4-mapped IPv6 address.
Returns a string for DNS reverse lookup compatible with RFC1886.
Set
date-time format.
datetime_format
A string suitable for passing to strftime
.
Returns the date format being used. See datetime_format=
Hadamard product
Matrix[[1,2], [3,4]].hadamard_product(Matrix[[1,2], [3,2]]) => 1 4 9 8
Explicit conversion to a Matrix
. Returns self
Returns the inner product of this vector with the other.
Vector[4,7].inner_product Vector[10,1] => 47
Return a single-column matrix from this vector
Creates an OptionParser::Switch
from the parameters. The parsed argument value is passed to the given block, where it can be processed.
See at the beginning of OptionParser
for some full examples.
opts
can include the following elements:
One of the following:
:NONE, :REQUIRED, :OPTIONAL
Acceptable option argument format, must be pre-defined with OptionParser.accept
or OptionParser#accept
, or Regexp
. This can appear once or assigned as String if not present, otherwise causes an ArgumentError
. Examples:
Float, Time, Array
Hash
or Array.
[:text, :binary, :auto] %w[iso-2022-jp shift_jis euc-jp utf8 binary] { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
Specifies a long style switch which takes a mandatory, optional or no argument. It’s a string of the following form:
"--switch=MANDATORY" or "--switch MANDATORY" "--switch[=OPTIONAL]" "--switch"
Specifies short style switch which takes a mandatory, optional or no argument. It’s a string of the following form:
"-xMANDATORY" "-x[OPTIONAL]" "-x"
There is also a special form which matches character range (not full set of regular expression):
"-[a-z]MANDATORY" "-[a-z][OPTIONAL]" "-[a-z]"
Instead of specifying mandatory or optional arguments directly in the switch parameter, this separate parameter can be used.
"=MANDATORY" "=[OPTIONAL]"
Description string for the option.
"Run verbosely"
Handler for the parsed argument value. Either give a block or pass a Proc
or Method
as an argument.
Returns the portion of the original string before the current match. Equivalent to the special variable $`
.
m = /(.)(.)(\d+)(\d)/.match("THX1138.") m.pre_match #=> "T"
Returns the portion of the original string after the current match. Equivalent to the special variable $'
.
m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie") m.post_match #=> ": The Movie"
Raises PStore::Error
if the calling code is not in a PStore#transaction
.
Dup internal hash.
Clone internal hash.