lib/mpatch/proc.rb in mpatch-1.3.0 vs lib/mpatch/proc.rb in mpatch-2.0.0
- old
+ new
@@ -1,12 +1,14 @@
-class Proc
+module MPatch
+ module Proc
- # sugar syntax for proc * operator
- # a = ->(x){x+1}
- # b = ->(x){x*10}
- # c = b*a
- # c.call(1) #=> 20
- def *(other)
- Proc.new { |*args| self[*other[*args]] }
- end unless method_defined? :*
+ # sugar syntax for proc * operator
+ # a = ->(x){x+1}
+ # b = ->(x){x*10}
+ # c = b*a
+ # c.call(1) #=> 20
+ def *(other)
+ self.class.new { |*args| self[*other[*args]] }
+ end
+ end
end