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.
Synopsis
require '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]
Author(s)
Thomas Sawyer
Methods
- collect
- detect
- each_by
- each_slice
- entries
- find
- find_all
- grep
- include?
- map
- max
- member?
- min
- reject
- select
- sort
- to_a
Constants
| VERSION | = | '0.9.0' |
Public Instance methods
Alias for each_slice
each_slice(*args, &yld)
[ source ]
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.
This method is also aliased as
each_by
Alias for to_a
Alias for detect
Alias for select
grep(pattern, *args) {|n| ...}
[ source ]
Alias for collect
max(*args)
[ source ]
Alias for include?
min(*args)
[ source ]
reject(*args) {|n| ...}
[ source ]
sort(*args)
[ source ]