Ruby Language instance_eval

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • object.instance_eval 'code'
  • object.instance_eval 'code', 'filename'
  • object.instance_eval 'code', 'filename', 'line number'
  • object.instance_eval { code }
  • object.instance_eval { |receiver| code }

Parameters

ParameterDetails
stringContains the Ruby source code to be evaluated.
filenameFile name to use for error reporting.
linenoLine number to use for error reporting.
blockThe block of code to be evaluated.
objThe receiver is passed to the block as its only argument.


Got any Ruby Language Question?