# File lib/facets/core/proc/bind.rb, line 14 def bind(object=nil) object ||= eval("self", self) block = self store = Object begin old, Thread.critical = Thread.critical, true #n=0; n+=1 while store.method_defined?(name="_bind_#{n}") name="_bind_#{block}" store.module_eval do define_method name, &block end return object.method(name) ensure store.module_eval do remove_method name #rescue nil #undef_method name #rescue nil end Thread.critical = old end end