Class: Object

Inherits:
BasicObject
Includes:
InstanceExecHelper
Defined in:
lib/validatable/object_extension.rb

Overview

:nodoc:

Defined Under Namespace

Modules: InstanceExecHelper

Instance Method Summary collapse

Instance Method Details

#instance_eval_with_params(*args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/validatable/object_extension.rb', line 5

def instance_eval_with_params(*args, &block)
  n = 0
  n += 1 while respond_to?(mname="__instance_exec#{n}")
  InstanceExecHelper.module_eval{ define_method(mname, &block) }
  begin
    ret = send(mname, *args)
  ensure
    InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
  end
  ret
end