Return consuming memory size of obj.
Note that the return size is incomplete. You need to deal with this information as only a HINT. Especially, the size of T_DATA
may not be correct.
This method is only expected to work with C Ruby.
From Ruby 2.2, memsize_of
(obj) returns a memory size includes sizeof(RVALUE).
Adds aProc as a finalizer, to be called after obj was destroyed. The object ID of the obj will be passed as an argument to aProc. If aProc is a lambda or method, make sure it can be called with a single argument.
Removes all finalizers for obj.
Parse a file at filename
. Returns the Psych::Nodes::Document
.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Dump a list of objects as separate documents to a document stream.
Example:
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
Load multiple documents given in yaml
. Returns the parsed documents as a list. If a block is given, each document will be converted to Ruby and passed to the block during parsing
Example:
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar'] list = [] Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby| list << ruby end list # => ['foo', 'bar']
Returns the version of libyaml being used
Returns the number of malloc() allocations.
Only available if ruby was built with CALC_EXACT_MALLOC_SIZE
.
Try to activate a gem containing path
. Returns true if activation succeeded or wasn’t needed because it was already activated. Returns false if it can’t find the path in a gem.
The mode needed to read a file as straight binary.
Finds the user’s home directory.
Loads YAML, preferring Psych
Safely read a file in binary mode on all platforms.
Safely write a file in binary mode on all platforms.
The home directory for the user.
Is this a windows platform?
Is this a java platform?
Default options for gem commands for Ruby implementers.
The options here should be structured as an array of string “gem” command names as keys and a string of the default options as values.
Example:
def self.platform_defaults
{ 'install' => '--no-rdoc --no-ri --env-shebang', 'update' => '--no-rdoc --no-ri --env-shebang' }
end
Allows toggling Windows behavior. This method is available when requiring ‘rubygems/test_case’
Copies stream src
to dest
. src
must respond to read(n) and dest
must respond to write(str).
Copies stream src
to dest
. src
must respond to read(n) and dest
must respond to write(str).
Returns true if the contents of a file a
and a file b
are identical.
FileUtils.compare_file('somefile', 'somefile') #=> true FileUtils.compare_file('/dev/null', '/dev/urandom') #=> false
Returns true if the contents of a file a
and a file b
are identical.
FileUtils.compare_file('somefile', 'somefile') #=> true FileUtils.compare_file('/dev/null', '/dev/urandom') #=> false
Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator
). The value is the accessor to which the methods will be delegated.