Sha256: 33be82544e2f28319ea353dc92d23d955502c9da44ea06b2f943dfa83446c4a9
Contents?: true
Size: 381 Bytes
Versions: 3
Compression:
Stored size: 381 Bytes
Contents
class Integer # Like #times but returns a collection of the yield results. # # a = 3.of { |i| "#{i+1}" } # a => [ "1", "2", "3" ] # def of(&block) Array.new(self, &block) end #def of(&yld) # a = []; self.times{ |i| a << yld.call(i) } # a #end # Time warn aliases for #of. alias_method :times_collect, :of alias_method :times_map, :of end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.0 | lib/core/facets/integer/of.rb |
facets-2.2.1 | lib/core/facets/integer/of.rb |
facets-2.3.0 | lib/core/facets/integer/of.rb |