This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

yield

        # Proc.yield

(from ruby core)
---
    yield(*args)

---

Invokes the block, setting the block's parameters to the values in
*params* using something close to method calling semantics. Returns the
value of the last expression evaluated in the block.

    a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
    a_proc.call(9, 1, 2, 3)    #=> [9, 18, 27]
    a_proc[9, 1, 2, 3]         #=> [9, 18, 27]
    a_proc.(9, 1, 2, 3)        #=> [9, 18, 27]
    a_proc.yield(9, 1, 2, 3)   #=> [9, 18, 27]

Note that `prc.()` invokes `prc.call()` with the parameters given.  It's
syntactic sugar to hide "call".

For procs created using #lambda or `->()` an error is generated if the
wrong number of parameters are passed to the proc.  For procs created
using Proc.new or Kernel.proc, extra parameters are silently discarded
and missing parameters are set to `nil`.

    a_proc = proc {|a,b| [a,b] }
    a_proc.call(1)   #=> [1, nil]

    a_proc = lambda {|a,b| [a,b] }
    a_proc.call(1)   # ArgumentError: wrong number of arguments (given 1, expected 2)

See also Proc#lambda?.


(This method is an alias for Proc#call.)

Invokes the block, setting the block's parameters to the values in
*params* using something close to method calling semantics. Returns the
value of the last expression evaluated in the block.

    a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
    a_proc.call(9, 1, 2, 3)    #=> [9, 18, 27]
    a_proc[9, 1, 2, 3]         #=> [9, 18, 27]
    a_proc.(9, 1, 2, 3)        #=> [9, 18, 27]
    a_proc.yield(9, 1, 2, 3)   #=> [9, 18, 27]

Note that `prc.()` invokes `prc.call()` with the parameters given.  It's
syntactic sugar to hide "call".

For procs created using #lambda or `->()` an error is generated if the
wrong number of parameters are passed to the proc.  For procs created
using Proc.new or Kernel.proc, extra parameters are silently discarded
and missing parameters are set to `nil`.

    a_proc = proc {|a,b| [a,b] }
    a_proc.call(1)   #=> [1, nil]

    a_proc = lambda {|a,b| [a,b] }
    a_proc.call(1)   # ArgumentError: wrong number of arguments (given 1, expected 2)

See also Proc#lambda?.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.