Counts all objects grouped by type.
It returns a hash, such as:
{ :TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, # ... }
The contents of the returned hash are implementation specific. It may be changed in future.
The keys starting with :T_
means live objects. For example, :T_ARRAY
is the number of arrays. :FREE
means object slots which is not used now. :TOTAL
means sum of above.
If the optional argument result_hash
is given, it is overwritten and returned. This is intended to avoid probe effect.
h = {} ObjectSpace.count_objects(h) puts h # => { :TOTAL=>10000, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249 }
This method is only expected to work on C Ruby.
Returns whether or not the function func
can be found in the common header files, or within any headers
that you provide. If found, a macro is passed as a preprocessor constant to the compiler using the function name, in uppercase, prepended with HAVE_
.
To check functions in an additional library, you need to check that library first using have_library()
. The func
shall be either mere function name or function name with arguments.
For example, if have_func('foo')
returned true
, then the HAVE_FOO
preprocessor macro would be passed to the compiler.
Return the number of observers associated with this object.
Push an event back on the head of the stream. This method has (theoretically) infinite depth.
Unescapes all possible entities
| FUNCTION_NAME ‘(’ ( expr ( ‘,’ expr )* )? ‘)’
Like Enumerable#chunk_while
, but chains operation to be lazy-evaluated.
Calls wait repeatedly until the given block yields a truthy value.