Returns the Encoding of the internal string if conversion is specified. Otherwise returns nil.
Returns the internal encoding for strings read from ARGF as an Encoding object.
If ARGF.set_encoding has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil is returned.
Returns true if this is a lower triangular matrix.
Returns true if this is an upper triangular matrix.
Outputs obj to out like PP.pp but with no indent and newline.
PP.singleline_pp returns out.
This is similar to PrettyPrint::format but the result has no breaks.
maxwidth, newline and genspace are ignored.
The invocation of breakable in the block doesn’t break a line and is treated as just an invocation of text.
Compiled instruction sequence represented by a RubyVM::InstructionSequence instance on the :script_compiled event.
Note that this method is MRI specific.
Returns whether or not the asynchronous queue is empty.
Since Thread::handle_interrupt can be used to defer asynchronous events, this method can be used to determine if there are any deferred events.
If you find this method returns true, then you may finish :never blocks.
For example, the following method processes deferred asynchronous events immediately.
def Thread.kick_interrupt_immediately Thread.handle_interrupt(Object => :immediate) { Thread.pass } end
If error is given, then check only for error type deferred events.
th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# reach safe point to invoke interrupt
if Thread.pending_interrupt?
Thread.handle_interrupt(Object => :immediate){}
end
...
end
}
}
...
th.raise # stop thread
This example can also be written as the following, which you should use to avoid asynchronous interrupts.
flag = true
th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# reach safe point to invoke interrupt
break if flag == false
...
end
}
}
...
flag = false # stop thread
Returns whether or not the asynchronous queue is empty for the target thread.
If error is given, then check only for error type deferred events.
See ::pending_interrupt? for more information.
Returns the Base64-encoded version of bin. This method complies with RFC 4648. No line feeds are added.
Returns the Base64-decoded version of str. This method complies with RFC 4648. ArgumentError is raised if str is incorrectly padded or contains non-alphabet characters. Note that CR or LF are also rejected.
Adds a post-install hook that will be passed an Gem::Installer instance when Gem::Installer#install is called
Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance and the spec that was uninstalled when Gem::Uninstaller#uninstall is called
Returns the destination encoding as an encoding object.
Returns the destination encoding as an encoding object.
Returns the destination encoding as an Encoding object.
Get an array of all Instruction children. IMMUTABLE
Called when an instruction is encountered. EG: <?xsl sheet=‘foo’?> @p name the instruction name; in the example, “xsl” @p instruction the rest of the instruction. In the example, “sheet=‘foo’”
Doesn’t handle namespaces yet
Returns the index of the last object in self == to obj.
If a block is given instead of an argument, returns the index of the first object for which the block returns true, starting from the last object.
Returns nil if no match is found.
See also Array#index.
If neither block nor argument is given, an Enumerator is returned instead.
a = [ "a", "b", "b", "b", "c" ] a.rindex("b") #=> 3 a.rindex("z") #=> nil a.rindex {|x| x == "b"} #=> 3