Returns true if the ipaddr is a private address. IPv4 addresses in 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 as defined in RFC 1918 and IPv6 Unique Local Addresses in fc00::/7 as defined in RFC 4193 are considered private.
Returns a new ipaddr built by converting the IPv6 address into a native IPv4 address. If the IP address is not an IPv4-mapped or IPv4-compatible IPv6 address, returns self.
Returns the netmask in string format e.g. 255.255.0.0
Set
current netmask to given mask.
Returns true
if and only if the current severity level allows for the printing of FATAL
messages.
Sets the severity to FATAL.
Terminates option parsing. Optional parameter arg
is a string pushed back to be the first non-option argument.
Puts option summary into to
and returns to
. Yields each line if a block is given.
to
Output destination, which must have method <<. Defaults to [].
width
Width of left side, defaults to @summary_width.
max
Maximum length allowed for left side, defaults to width
- 1.
indent
Indentation, defaults to @summary_indent.
Add separator in summary.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Returns the path to the data store file.
Returns the full path name of the temporary file. This will be nil if unlink
has been called.
Creates a temporary file as a usual File
object (not a Tempfile
). It does not use finalizer and delegation, which makes it more efficient and reliable.
If no block is given, this is similar to Tempfile.new
except creating File
instead of Tempfile
. In that case, the created file is not removed automatically. You should use File.unlink
to remove it.
If a block is given, then a File
object will be constructed, and the block is invoked with the object as the argument. The File
object will be automatically closed and the temporary file is removed after the block terminates, releasing all resources that the block created. The call returns the value of the block.
In any case, all arguments (basename
, tmpdir
, mode
, and **options
) will be treated the same as for Tempfile.new
.
Tempfile.create('foo', '/home/temp') do |f| # ... do something with f ... end
Returns whether the method is private.
Returns whether the method is private.
returns main ractor
Returns the main thread.
Terminates thr
and schedules another thread to be run, returning the terminated Thread
. If this is the main thread, or the last thread, exits the process.
Returns the status of thr
.
"sleep"
Returned if this thread is sleeping or waiting on I/O
"run"
When this thread is executing
"aborting"
If this thread is aborting
false
When this thread is terminated normally
nil
If terminated with an exception.
a = Thread.new { raise("die now") } b = Thread.new { Thread.stop } c = Thread.new { Thread.exit } d = Thread.new { sleep } d.kill #=> #<Thread:0x401b3678 aborting> a.status #=> nil b.status #=> "sleep" c.status #=> false d.status #=> "aborting" Thread.current.status #=> "run"
Returns internal information of TracePoint
.
The contents of the returned value are implementation specific. It may be changed in future.
This method is only for debugging TracePoint
itself.
Path of the file being run
Returns the \BigDecimal converted from +value+ with a precision of +ndigits+ decimal digits. When +ndigits+ is less than the number of significant digits in the value, the result is rounded to that number of digits, according to the current rounding mode; see BigDecimal.mode.
Returns value
converted to a BigDecimal, depending on the type of value
:
Integer
, Float
, Rational
, Complex
, or BigDecimal: converted directly:
# Integer, Complex, or BigDecimal value does not require ndigits; ignored if given. BigDecimal(2) # => 0.2e1 BigDecimal(Complex(2, 0)) # => 0.2e1 BigDecimal(BigDecimal(2)) # => 0.2e1 # Float or Rational value requires ndigits. BigDecimal(2.0, 0) # => 0.2e1 BigDecimal(Rational(2, 1), 0) # => 0.2e1
String: converted by parsing if it contains an integer or floating-point literal; leading and trailing whitespace is ignored:
# String does not require ndigits; ignored if given. BigDecimal('2') # => 0.2e1 BigDecimal('2.0') # => 0.2e1 BigDecimal('0.2e1') # => 0.2e1 BigDecimal(' 2.0 ') # => 0.2e1
Other type that responds to method :to_str
: first converted to a string, then converted to a BigDecimal, as above.
Other type:
Raises an exception if keyword argument exception
is true
.
Returns nil
if keyword argument exception
is true
.
Raises an exception if value
evaluates to a Float
and digits
is larger than Float::DIG + 1.