~nchohan/appscale/GAE1.4.0-namespaces

« back to all changes in this revision

Viewing changes to AppLoadBalancer/vendor/gems/validatable-1.6.7/lib/object_extension.rb

  • Committer: Chris Bunch
  • Date: 2009-11-16 18:37:46 UTC
  • mto: This revision was merged to the branch mainline in revision 303.
  • Revision ID: chris@magna-carta-20091116183746-1sqxle515itjf6si
added fix for create_user on load balancer

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class Object #:nodoc:
 
2
  module InstanceExecHelper #:nodoc:
 
3
  end
 
4
  include InstanceExecHelper
 
5
  def instance_eval_with_params(*args, &block)
 
6
    begin
 
7
      old_critical, Thread.critical = Thread.critical, true
 
8
      n = 0
 
9
      n += 1 while respond_to?(mname="__instance_exec#{n}")
 
10
      InstanceExecHelper.module_eval{ define_method(mname, &block) }
 
11
    ensure
 
12
      Thread.critical = old_critical
 
13
    end
 
14
    begin
 
15
      ret = send(mname, *args)
 
16
    ensure
 
17
      InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
 
18
    end
 
19
    ret
 
20
  end
 
21
end
 
 
b'\\ No newline at end of file'