Returns the destination encoding as an Encoding
object.
Clear recorded tracing information.
Yields each frame of the current execution stack as a backtrace location object.
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.
Returns the method identifier for the given object
.
class A include ObjectSpace def foo trace_object_allocations do obj = Object.new p "#{allocation_class_path(obj)}##{allocation_method_id(obj)}" end end end A.new.foo #=> "Class#new"
See ::trace_object_allocations
for more information and examples.
The file name and line number of the caller of the caller of this method.
depth
is how many layers up the call stack it should go.
e.g.,
def a; Gem.location_of_caller
; end a #=> [“x.rb”, 2] # (it’ll vary depending on file name and line number)
def b; c; end def c; Gem.location_of_caller(2)
; end b #=> [“x.rb”, 6] # (it’ll vary depending on file name and line number)
Path to specification files of default gems.
Get the names of all sections in the current configuration.
Get the indentation level.
Set
the indentation level to level
. The level must be less than 10 and greater than 1.
Convert 64-bit FILETIME integer into Time
object.
Sends an Options request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Options
object created from string path
and initial headers hash initheader
.
http = Net::HTTP.new(hostname) http.options('/')
Sends an Options request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Options
object created from string path
and initial headers hash initheader
.
http = Net::HTTP.new(hostname) http.options('/')
A Location
object representing the location of this token in the source.