Sha256: a25475f9f349f6b9df575c58feb44b2912a1597f56370a8396efb555ed57cefe

Contents?: true

Size: 406 Bytes

Versions: 7

Compression:

Stored size: 406 Bytes

Contents

class Proc
  def bind(object)
    block, time = self, Time.now
    (class << object; self; end).class_eval do
      method_name = "__bind_#{time.to_i}_#{time.usec}"
      define_method(method_name, &block)
      method = instance_method(method_name)
      remove_method(method_name)
      method
    end.bind(object)
  end
  def in_context(klass_or_obj)
    klass_or_obj.send(:eval, self.to_ruby)
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
auser-poolparty-0.0.8 lib/core/proc.rb
auser-poolparty-0.0.9 lib/core/proc.rb
auser-poolparty-0.1.0 lib/core/proc.rb
auser-poolparty-0.1.1 lib/core/proc.rb
auser-poolparty-0.1.2 lib/core/proc.rb
dreadpiratepj-poolparty-0.0.8 lib/core/proc.rb
jtzemp-poolparty-0.1.2 lib/core/proc.rb