Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/instance_exec.rb
Overview
Add an instance_exec method to the Object class unless it’s already there.
Instance Method Summary collapse
-
#instance_exec(*arguments, &block) ⇒ Object
This binds a block to an arbitrary scope and calls it (with or without arguments).
Instance Method Details
#instance_exec(*arguments, &block) ⇒ Object
This binds a block to an arbitrary scope and calls it (with or without arguments).
29 30 31 |
# File 'lib/instance_exec.rb', line 29 def instance_exec(*arguments, &block) block.bind(self)[*arguments] end |