Results for: "minmax"

No documentation available

With a block given, calls the block with each element and its index; returns self:

h = {}
(1..4).each_with_index {|element, i| h[element] = i } # => 1..4
h # => {1=>0, 2=>1, 3=>2, 4=>3}

h = {}
%w[a b c d].each_with_index {|element, i| h[element] = i }
# => ["a", "b", "c", "d"]
h # => {"a"=>0, "b"=>1, "c"=>2, "d"=>3}

a = []
h = {foo: 0, bar: 1, baz: 2}
h.each_with_index {|element, i| a.push([i, element]) }
# => {:foo=>0, :bar=>1, :baz=>2}
a # => [[0, [:foo, 0]], [1, [:bar, 1]], [2, [:baz, 2]]]

With no block given, returns an Enumerator.

Returns the last win32 Error of the current executing Thread or nil if none

Sets the last win32 Error of the current executing Thread to error

MRI specific feature

Return internal class of obj.

obj can be an instance of InternalObjectWrapper.

Note that you should not use this method in your application.

MRI specific feature

Return internal super class of cls (Class or Module).

obj can be an instance of InternalObjectWrapper.

Note that you should not use this method in your application.

Verify internal consistency.

This method is implementation specific. Now this method checks generational consistency if RGenGC is supported.

Returns the size of memory allocated by malloc().

Only available if ruby was built with CALC_EXACT_MALLOC_SIZE.

Returns information about object moved in the most recent GC compaction.

The returned hash contains the following keys:

considered

Hash containing the type of the object as the key and the number of objects of that type that were considered for movement.

moved

Hash containing the type of the object as the key and the number of objects of that type that were actually moved.

moved_up

Hash containing the type of the object as the key and the number of objects of that type that were increased in size.

moved_down

Hash containing the type of the object as the key and the number of objects of that type that were decreased in size.

Some objects can’t be moved (due to pinning) so these numbers can be used to calculate compaction efficiency.

Returns information about the most recent garbage collection.

If the optional argument, hash, is given, it is overwritten and returned. This is intended to avoid probe effect.

Returns a list of paths matching glob from the latest gems that can be used by a gem to pick up features from other gems. For example:

Gem.find_latest_files('rdoc/discover').each do |path| load path end

if check_load_path is true (the default), then find_latest_files also searches $LOAD_PATH for files as well as gems.

Unlike find_files, find_latest_files will return only files from the latest version of a gem.

No documentation available

Glob pattern for require-able plugin suffixes.

Regexp for require-able plugin suffixes.

Suffixes for dynamic library require-able paths.

Find all ‘rubygems_plugin’ files in $LOAD_PATH and load them

Find a Gem::Specification of default gem from path

Finds the user’s config file

Deduce Ruby’s –program-prefix and –program-suffix from its install name

Default options for gem commands for Ruby packagers.

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.operating_system_defaults

{
    'install' => '--no-rdoc --no-ri --env-shebang',
    'update' => '--no-rdoc --no-ri --env-shebang'
}

end

Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect:

def_delegators :@records, :size, :<<, :map

def_delegator :@records, :size
def_delegator :@records, :<<
def_delegator :@records, :map

Define method as delegator instance method with an optional alias name ali. Method calls to ali will be delegated to accessor.method. accessor should be a method name, instance variable name, or constant name. Use the full path to the constant if providing the constant name. Returns the name of the method defined.

class MyQueue
  CONST = 1
  extend Forwardable
  attr_reader :queue
  def initialize
    @queue = []
  end

  def_delegator :@queue, :push, :mypush
  def_delegator 'MyQueue::CONST', :to_i
end

q = MyQueue.new
q.mypush 42
q.queue    #=> [42]
q.push 23  #=> NoMethodError
q.to_i     #=> 1

Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect:

def_delegators :@records, :size, :<<, :map

def_delegator :@records, :size
def_delegator :@records, :<<
def_delegator :@records, :map

Defines a method method which delegates to accessor (i.e. it calls the method of the same name in accessor). If new_name is provided, it is used as the name for the delegate method. Returns the name of the method defined.

No documentation available
Search took: 5ms  ·  Total Results: 2365