Sha256: 8c5e235dae25eaac21116036e6e03f5c98fdf16cb8be5e5cd84f179a7d608ac9
Contents?: true
Size: 659 Bytes
Versions: 3
Compression:
Stored size: 659 Bytes
Contents
require 'facets/enumerable/per' module Enumerable # Returns an elemental object. This allows # you to map a method on to every element. # # r = [1,2,3].every + 3 #=> [4,5,6] # def every @_every ||= per(:map) end # In place version of #every. # def every! raise NoMethodError unless respond_to?(:map!) @_every_inplace ||= per(:map!) end #def every # @_every ||= Functor.new do |op,*args| # map{ |a| a.send(op,*args) } # end #end #def every! # raise NoMethodError unless respond_to?(:map!) # @_every_inplace ||= Functor.new do |op,*args| # map!{ |a| a.send(op,*args) } # end #end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.8.1 | lib/core/facets/enumerable/every.rb |
facets-2.8.0 | lib/core/facets/enumerable/every.rb |
facets-2.7.0 | lib/core/facets/enumerable/every.rb |