lib/facets/core/enumerable/every.rb in facets-1.7.46 vs lib/facets/core/enumerable/every.rb in facets-1.8.0
- old
+ new
@@ -9,11 +9,11 @@
# [1,2,3].every + 3 #=> [4,5,6]
#
# ['a','b','c'].every.upcase #=> ['A','B','C']
#
def every
- Functor.new do |op,*args|
+ @_functor_every ||= Functor.new do |op,*args|
self.collect{ |a| a.send(op,*args) }
end
end
end
@@ -21,10 +21,10 @@
class Array
# In place version of #every.
def every!
- Functor.new do |op,*args|
+ @_functor_every_inplace ||= Functor.new do |op,*args|
self.replace( self.collect{ |a| a.send(op,*args) } )
end
end
end