Module | EnumerableArgs |
In: |
lib/facet/enumerable-args.rb
|
This is a simple reimplementation of the core Enumerable module to allow the methods to take and pass-on arbitrary arguments to the underlying each call.
require 'facet/enumerable-args' class T include EnumerableArgs def initialize(arr) @arr = arr end def each(n) arr.each{ |e| yield(e+n) } end end t = T.new([1,2,3]) t.collect(4) #=> [5,6,7]
The sort method still needs to be done.
VERSION | = | '0.9.0' |
An additional method not part of standard Enumerable. The regular version of this method can be found in Facets, but it is a bit more advanced then this one. At some point they need to be put into sync.