lib/abstractivator/proc_ext.rb in abstractivator-0.0.16 vs lib/abstractivator/proc_ext.rb in abstractivator-0.0.18
- old
+ new
@@ -1,5 +1,7 @@
+require 'abstractivator/enumerable_ext'
+
module MethodAndProcExtensions
def loosen_args
proc do |*args, &block|
Proc.loose_call(self, args, &block)
end
@@ -12,10 +14,10 @@
def compose(other)
proc{|x| self.call(other.call(x))}
end
def self.compose(*procs)
- procs.inject_right(identity) { |inner, p| p.compose(inner) }
+ procs.map(&:to_proc).inject_right(identity) { |inner, p| p.compose(inner) }
end
def self.identity
proc {|x| x}
end