lib/bindless/proc.rb in bindless-1.0.0 vs lib/bindless/proc.rb in bindless-1.0.1
- old
+ new
@@ -1,18 +1,26 @@
-class Proc
+module Bindless
- def call_with_binding(bind, *args)
- Bindless::Model.new([bind]).run_proc(self, *args)
- end
+ module EXT
+ module Proc
- 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
+ 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
- m.bind(obj).call(*args)
end
-end
+end
+
+Proc.__send__ :include, Bindless::EXT::Proc
\ No newline at end of file