Returns garbage collector generation for the given object
.
class B include ObjectSpace def foo trace_object_allocations do obj = Object.new p "Generation is #{allocation_generation(obj)}" end end end B.new.foo #=> "Generation is 3"
See ::trace_object_allocations
for more information and examples.
Parse a YAML string in yaml
. Returns the Psych::Nodes::Stream
. This method can handle multiple YAML documents contained in yaml
. filename
is used in the exception message if a Psych::SyntaxError
is raised.
If a block is given, a Psych::Nodes::Document
node will be yielded to the block as it’s being parsed.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Example:
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00> Psych.parse_stream("--- a\n--- b") do |node| node # => #<Psych::Nodes::Document:0x00> end begin Psych.parse_stream("--- `", "file.txt") rescue Psych::SyntaxError => ex ex.file # => 'file.txt' ex.message # => "(file.txt): found character that cannot start any token" end
See Psych::Nodes
for more information about YAML AST.
Returns true if the contents of a stream a
and b
are identical.
Returns true if the contents of a stream a
and b
are identical.
Returns an Array of method names which have the option opt
.
p FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
Returns whether or not the given framework
can be found on your system. If found, a macro is passed as a preprocessor constant to the compiler using the framework name, in uppercase, prepended with HAVE_FRAMEWORK_
.
For example, if have_framework('Ruby')
returned true, then the HAVE_FRAMEWORK_RUBY
preprocessor macro would be passed to the compiler.
If fw
is a pair of the framework name and its header file name that header file is checked, instead of the normally used header file which is named same as the framework.
Glob pattern for require-able path suffixes.
Constructs proper parameters from arguments
A private helper method
record class_name
for the supplied uri and tag_name
The full path to the gem (install path + full name).
Full paths in the gem to add to $LOAD_PATH
when this gem is activated.
The name of the configuration file.
Removes the gemspec matching full_name
from the dependency list
Split the Gem search path (as reported by Gem.path
).
Find
the best specification matching a name
and requirements
. Raises if the dependency doesn’t resolve to a valid specification.
Return the best specification that contains the file matching path
.
Expire memoized instance variables that can incorrectly generate, replace or miss files due changes in certain attributes used to compute them.
TODO: move to minitest