Results for: "match"

Sets create identifier, which is used to decide if the json_create hook of a class should be called; initial value is json_class:

JSON.create_id # => 'json_class'

Returns the current create identifier. See also JSON.create_id=.

Arguments obj and opts here are the same as arguments obj and opts in JSON.generate.

By default, generates JSON data without checking for circular references in obj (option max_nesting set to false, disabled).

Raises an exception if obj contains circular references:

a = []; b = []; a.push(b); b.push(a)
# Raises SystemStackError (stack level too deep):
JSON.fast_generate(a)

Arguments obj and opts here are the same as arguments obj and opts in JSON.generate.

Default options are:

{
  indent: '  ',   # Two spaces
  space: ' ',     # One space
  array_nl: "\n", # Newline
  object_nl: "\n" # Newline
}

Example:

obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
json = JSON.pretty_generate(obj)
puts json

Output:

{
  "foo": [
    "bar",
    "baz"
  ],
  "bat": {
    "bam": 0,
    "bad": 1
  }
}

Enters exclusive section and executes the block. Leaves the exclusive section automatically when the block exits. See example under MonitorMixin.

Returns the source file origin from the given object.

See ::trace_object_allocations for more information and examples.

Returns the original line from source for from the given object.

See ::trace_object_allocations for more information and examples.

Calls the block once for each living, nonimmediate object in this Ruby process. If module is specified, calls the block for only those classes or modules that match (or are a subclass of) module. Returns the number of objects found. Immediate objects (Fixnums, Symbols true, false, and nil) are never returned. In the example below, each_object returns both the numbers we defined and several constants defined in the Math module.

If no block is given, an enumerator is returned instead.

a = 102.7
b = 95       # Won't be returned
c = 12345678987654321
count = ObjectSpace.each_object(Numeric) {|x| p x }
puts "Total count: #{count}"

produces:

12345678987654321
102.7
2.71828182845905
3.14159265358979
2.22044604925031e-16
1.7976931348623157e+308
2.2250738585072e-308
Total count: 7

Returns information for heaps in the GC.

If the first optional argument, heap_name, is passed in and not nil, it returns a Hash containing information about the particular heap. Otherwise, it will return a Hash with heap names as keys and a Hash containing information about the heap as values.

If the second optional argument, hash_or_key, is given as Hash, it will be overwritten and returned. This is intended to avoid the probe effect.

If both optional arguments are passed in and the second optional argument is a symbol, it will return a Numeric of the value for the particular heap.

On CRuby, heap_name is of the type Integer but may be of type String on other implementations.

The contents of the hash are implementation specific and may change in the future without notice.

If the optional argument, hash, is given, it is overwritten and returned.

This method is only expected to work on CRuby.

The hash includes the following keys about the internal information in the GC:

slot_size

The slot size of the heap in bytes.

heap_allocatable_pages

The number of pages that can be allocated without triggering a new garbage collection cycle.

heap_eden_pages

The number of pages in the eden heap.

heap_eden_slots

The total number of slots in all of the pages in the eden heap.

heap_tomb_pages

The number of pages in the tomb heap. The tomb heap only contains pages that do not have any live objects.

heap_tomb_slots

The total number of slots in all of the pages in the tomb heap.

total_allocated_pages

The total number of pages that have been allocated in the heap.

total_freed_pages

The total number of pages that have been freed and released back to the system in the heap.

force_major_gc_count

The number of times major garbage collection cycles this heap has forced to start due to running out of free slots.

force_incremental_marking_finish_count

The number of times this heap has forced incremental marking to complete due to running out of pooled slots.

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.

Find the full path to the executable for gem name. If the exec_name is not given, an exception will be raised, otherwise the specified executable’s path is returned. requirements allows you to specify specific gem versions.

Reset the dir and path values. The next time dir or path is requested, the values will be calculated from scratch. This is mainly used by the unit tests to provide test isolation.

The version of the Marshal format for your Ruby.

Glob pattern for require-able path suffixes.

Use the home and paths values for Gem.dir and Gem.path. Used mainly by the unit tests to provide environment isolation.

Is this a windows platform?

Is this a java platform?

Is this platform Solaris?

The path to standard location of the user’s state file.

The path to standard location of the user’s cache directory.

The path to standard location of the user’s data directory.

The path to standard location of the user’s state directory.

Default gem load path

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

Returns a sharable hash map of error types and spell checker objects.

Search took: 2ms  ·  Total Results: 2422