Returns the current object method calls are being delegated to.
Changes the delegate object to obj.
It’s important to note that this does not cause SimpleDelegator’s methods to change. Because of this, you probably only want to change delegation to objects of the same type as the original delegate.
Here’s an example of changing the delegation object.
names = SimpleDelegator.new(%w{James Edward Gray II}) puts names[1] # => Edward names.__setobj__(%w{Gavin Sinclair}) puts names[1] # => Sinclair
Convert a network byte ordered string form of an IP address into human readable form.
Returns a network byte ordered string form of the IP address.
Returns the (row, column) cofactor which is obtained by multiplying the first minor by (-1)**(row + column).
Matrix.diagonal(9, 5, -3, 4).cofactor(1, 1) => -108
Creates a single-row matrix from this vector.
Add separator in summary.
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
Stops execution of the current thread, putting it into a “sleep” state, and schedules execution of another thread.
a = Thread.new { print "a"; Thread.stop; print "c" } sleep 0.1 while a.status!='sleep' print "b" a.run a.join #=> "abc"
Returns true
if thr
is dead or sleeping.
a = Thread.new { Thread.stop } b = Thread.current a.stop? #=> true b.stop? #=> false
Registers filename to be loaded (using Kernel::require
) the first time that module (which may be a String
or a symbol) is accessed.
autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
Returns filename to be loaded if name is registered as autoload
.
autoload(:B, "b") autoload?(:B) #=> "b"
Returns true
if yield
would execute a block in the current context. The iterator?
form is mildly deprecated.
def try if block_given? yield else "no block" end end try #=> "no block" try { "hello" } #=> "hello" try do "hello" end #=> "hello"
Convert str
to ISO-2022-JP
Convert str
to ISO-2022-JP
Convert str
to EUC-JP
Convert str
to EUC-JP
Convert str
to Shift_JIS
Convert str
to Shift_JIS
Convert str
to UTF-8