Sha256: d105afcc3bc92296e2144e12f230c167ca0cab630bed1cf08a9354ed24481875

Contents?: true

Size: 417 Bytes

Versions: 18

Compression:

Stored size: 417 Bytes

Contents

module Packable
  module Extensions #:nodoc:
    module Proc
      # A bit of wizardry to return an +UnboundMethod+ which can be bound to any object
      def unbind
        Object.send(:define_method, :__temp_bound_method, &self)
        Object.instance_method(:__temp_bound_method)
      end
      
      # Shortcut for <tt>unbind.bind(to)</tt>
      def bind(to)
        unbind.bind(to)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
packable-1.3.9 lib/packable/extensions/proc.rb
packable-1.3.8 lib/packable/extensions/proc.rb
packable-1.3.7 lib/packable/extensions/proc.rb
marcandre-packable-1.1.1 lib/packable/extensions/proc.rb
marcandre-packable-1.1.2 lib/packable/extensions/proc.rb
marcandre-packable-1.1.3 lib/packable/extensions/proc.rb
marcandre-packable-1.2.0 lib/packable/extensions/proc.rb
marcandre-packable-1.2.1 lib/packable/extensions/proc.rb
marcandre-packable-1.3.0 lib/packable/extensions/proc.rb
marcandre-packable-1.3.1 lib/packable/extensions/proc.rb
marcandre-packable-1.3.2 lib/packable/extensions/proc.rb
packable-1.3.6 lib/packable/extensions/proc.rb
packable-1.3.5 lib/packable/extensions/proc.rb
packable-1.3.2 lib/packable/extensions/proc.rb
packable-1.3.1 lib/packable/extensions/proc.rb
packable-1.3.0 lib/packable/extensions/proc.rb
packable-1.2.1 lib/packable/extensions/proc.rb
packable-1.2.0 lib/packable/extensions/proc.rb