Module Monkey::Ext::Object
In: lib/monkey/ext/object.rb
lib/monkey/ext/object.rb

Methods

Public Instance methods

Behaves like instance_eval or yield depending on whether a block takes an argument or not.

  class Foo
    define_method(:foo) { 42 }
  end

  Foo.new.instance_yield { foo }        # => 42
  Foo.new.instance_yield { |c| c.foo }  # => 42

Also, you can pass a proc directly:

  block = proc { }
  instance_yield(block)

Behaves like instance_eval or yield depending on whether a block takes an argument or not.

  class Foo
    define_method(:foo) { 42 }
  end

  Foo.new.instance_yield { foo }        # => 42
  Foo.new.instance_yield { |c| c.foo }  # => 42

Also, you can pass a proc directly:

  block = proc { }
  instance_yield(block)

[Validate]