Class: Object

Inherits:
BasicObject
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#yield_self {|x| ... } ⇒ Object #then {|x| ... } ⇒ Object

Yields self to the block and returns the result of the block.

3.next.yield_self {|x| x**x }.to_s       #=> "256"
"my string".yield_self {|s| s.upcase }   #=> "MY STRING"

Overloads:

  • #yield_self {|x| ... } ⇒ Object

    Yields:

    • (x)

    Returns:

  • #then {|x| ... } ⇒ Object

    Yields:

    • (x)

    Returns:



43
44
45
46
47
48
# File 'ext/backport_yield_self/backport_yield_self.c', line 43

static VALUE
rb_obj_yield_self(VALUE obj)
{
    RETURN_SIZED_ENUMERATOR(obj, 0, 0, rb_obj_size);
    return rb_yield_values2(1, &obj);
}

#yield_self {|x| ... } ⇒ Object #then {|x| ... } ⇒ Object

Yields self to the block and returns the result of the block.

3.next.yield_self {|x| x**x }.to_s       #=> "256"
"my string".yield_self {|s| s.upcase }   #=> "MY STRING"

Overloads:

  • #yield_self {|x| ... } ⇒ Object

    Yields:

    • (x)

    Returns:

  • #then {|x| ... } ⇒ Object

    Yields:

    • (x)

    Returns:



43
44
45
46
47
48
# File 'ext/backport_yield_self/backport_yield_self.c', line 43

static VALUE
rb_obj_yield_self(VALUE obj)
{
    RETURN_SIZED_ENUMERATOR(obj, 0, 0, rb_obj_size);
    return rb_yield_values2(1, &obj);
}