Method: Object#bind

Defined in:
lib/ruby/object.rb

#bind {|_self| ... } ⇒ Object

Yields ‘self` to a block argument

Examples:

nil.bind{|a| a.nil? }   #=> true
100.bind{|a| a.nil? }   #=> false

Yields:

  • (_self)

Yield Parameters:

  • _self (Object)

    the object that the method was called on



39
40
41
# File 'lib/ruby/object.rb', line 39

def bind
  yield self
end