Results for: "to_proc"

Returns true if yield would execute a block in the current context. The iterator? form is mildly deprecated.

def try
  if block_given?
    yield
  else
    "no block"
  end
end
try                  #=> "no block"
try { "hello" }      #=> "hello"
try do "hello" end   #=> "hello"

Groups the collection by result of the block. Returns a hash where the keys are the evaluated result from the block and the values are arrays of elements in the collection that correspond to the key.

If no block is given an enumerator is returned.

(1..6).group_by { |i| i%3 }   #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}

Drops elements up to, but not including, the first element for which the block returns nil or false and returns an array containing the remaining elements.

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

a = [1, 2, 3, 4, 5, 0]
a.drop_while { |i| i < 3 }   #=> [3, 4, 5, 0]

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

Sets the last Error of the current executing Thread to error

Generate a JSON document from the Ruby data structure obj and return it. The returned document is a prettier form of the document returned by unparse.

The opts argument can be used to configure the generator. See the generate method for a more detailed explanation.

Returns true if this monitor is locked by any thread

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.

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.

Sets the list of characters that are word break characters, but should be left in text when it is passed to the completion function. Programs can use this to help determine what kind of completing to do. For instance, Bash sets this variable to “$@” so that it can complete shell variables and hostnames.

See GNU Readline’s rl_special_prefixes variable.

Raises NotImplementedError if the using readline library does not support.

Gets the list of characters that are word break characters, but should be left in text when it is passed to the completion function.

See GNU Readline’s rl_special_prefixes variable.

Raises NotImplementedError if the using readline library does not support.

Adds a pre-install hook that will be passed an Gem::Installer instance when Gem::Installer#install is called. If the hook returns false then the install will be aborted.

Adds a hook that will get run before Gem::Specification.reset is run.

Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance and the spec that will be uninstalled when Gem::Uninstaller#uninstall is called

Adds DidYouMean functionality to an error using a given spell checker

Returns whether or not macro is defined either in the common header files or within any headers you provide.

Any options you pass to opt are passed along to the compiler.

See Mutex#synchronize

See Mutex#locked?

See Mutex#lock

See Mutex#unlock

No documentation available
No documentation available

Indicates whether this DH instance has a private key associated with it or not. The private key may be retrieved with DH#priv_key.

Search took: 4ms  ·  Total Results: 2024