Raises PStore::Error if the calling code is not in a PStore#transaction or if the code is in a read-only PStore#transaction.
Returns the status of the global “abort on exception” condition.
The default is false.
When set to true, if any thread is aborted by an exception, the raised exception will be re-raised in the main thread.
Can also be specified by the global $DEBUG flag or command line option -d.
See also ::abort_on_exception=.
There is also an instance level method to set this for a specific thread, see abort_on_exception.
When set to true, if any thread is aborted by an exception, the raised exception will be re-raised in the main thread. Returns the new state.
Thread.abort_on_exception = true t1 = Thread.new do puts "In new thread" raise "Exception from thread" end sleep(1) puts "not reached"
This will produce:
In new thread prog.rb:4: Exception from thread (RuntimeError) from prog.rb:2:in `initialize' from prog.rb:2:in `new' from prog.rb:2
See also ::abort_on_exception.
There is also an instance level method to set this for a specific thread, see abort_on_exception=.
Returns the status of the thread-local “abort on exception” condition for this thr.
The default is false.
See also abort_on_exception=.
There is also a class level method to set this for all threads, see ::abort_on_exception.
When set to true, if this thr is aborted by an exception, the raised exception will be re-raised in the main thread.
See also abort_on_exception.
There is also a class level method to set this for all threads, see ::abort_on_exception=.
Starts tracing object allocations from the ObjectSpace extension module.
For example:
require 'objspace' class C include ObjectSpace def foo trace_object_allocations do obj = Object.new p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}" end end end C.new.foo #=> "objtrace.rb:8"
This example has included the ObjectSpace module to make it easier to read, but you can also use the ::trace_object_allocations notation (recommended).
Note that this feature introduces a huge performance decrease and huge memory consumption.
Sets whether or not to ignore case on completion.
Returns true if completion ignores case. If no, returns false.
NOTE: Returns the same object that is specified by Readline.completion_case_fold= method.
require "readline" Readline.completion_case_fold = "This is a String." p Readline.completion_case_fold # => "This is a String."
Specifies a character to be appended on completion. Nothing will be appended if an empty string (“”) or nil is specified.
For example:
require "readline" Readline.readline("> ", true) Readline.completion_append_character = " "
Result:
> Input "/var/li". > /var/li Press TAB key. > /var/lib Completes "b" and appends " ". So, you can continuously input "/usr". > /var/lib /usr
NOTE: Only one character can be specified. When “string” is specified, sets only “s” that is the first.
require "readline" Readline.completion_append_character = "string" p Readline.completion_append_character # => "s"
Raises NotImplementedError if the using readline library does not support.
Returns a string containing a character to be appended on completion. The default is a space (“ ”).
Raises NotImplementedError if the using readline library does not support.
Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect:
def_delegators :@records, :size, :<<, :map def_delegator :@records, :size def_delegator :@records, :<< def_delegator :@records, :map
Define method as delegator instance method with an optional alias name ali. Method calls to ali will be delegated to accessor.method.
class MyQueue extend Forwardable attr_reader :queue def initialize @queue = [] end def_delegator :@queue, :push, :mypush end q = MyQueue.new q.mypush 42 q.queue #=> [42] q.push 23 #=> NoMethodError
Hangul Algorithm
Canonical Ordering
Returns a new array containing self‘s elements in reverse order.
[ "a", "b", "c" ].reverse #=> ["c", "b", "a"] [ 1 ].reverse #=> [1]
Reverses self in place.
a = [ "a", "b", "c" ] a.reverse! #=> ["c", "b", "a"] a #=> ["c", "b", "a"]
Returns the remainder after dividing big by numeric.
-1234567890987654321.remainder(13731) #=> -6966 -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
Returns a new string with the characters from str in reverse order.
"stressed".reverse #=> "desserts"
Reverses str in place.
Return the receiver associated with this NameError exception.
Returns the remainder from dividing by the value.
x.remainder(y) means x-y*(x/y).truncate
The opposite of Pathname#absolute?
It returns false if the pathname begins with a slash.
p = Pathname.new('/im/sure') p.relative? #=> false p = Pathname.new('not/so/sure') p.relative? #=> true
Returns a string for DNS reverse lookup. It returns a string in RFC3172 form for an IPv6 address.