Sha256: b493a513908aeff78814f3bd5f5674a67cc0e13bcb38b90eb1b6b8e0ae2edf89

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

module Bindless

  module EXT
    module Proc

      def call_with_binding(bind, *args)
        ::Bindless::Model.new([bind]).run_proc(self, *args)
      end

      def call_with_obj(obj, *args)
        m = nil
        p = self
        ::Object.class_eval do
          define_method :a_temp_method_name, &p
          m = instance_method :a_temp_method_name
          remove_method :a_temp_method_name
        end
        m.bind(obj).call(*args)
      end

    end
  end

end

Proc.__send__ :include, Bindless::EXT::Proc

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bindless-1.0.1 lib/bindless/proc.rb