Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
3 additions
and
3 deletions.
-
+2
−2
lib-topaz/enumerable.rb
-
+1
−1
lib-topaz/enumerator.rb
|
@@ -12,7 +12,7 @@ def map(&block) |
|
|
return self.enum_for(:map) unless block |
|
|
result = [] |
|
|
self.each do |*x| |
|
|
result << (yield *x) |
|
|
result << yield(*x) |
|
|
end |
|
|
result |
|
|
end |
|
@@ -208,7 +208,7 @@ def min(&block) |
|
|
|
|
|
def max_by(&block) |
|
|
return self.enum_for(:max_by) unless block |
|
|
max = maxv = nil |
|
|
max = maxv = nil |
|
|
self.each_with_index do |e, i| |
|
|
ev = yield(e) |
|
|
max, maxv = e, ev if i == 0 || Topaz.compare(ev, maxv) > 0 |
|
|
|
@@ -71,7 +71,7 @@ def initialize(&block) |
|
|
end |
|
|
|
|
|
def each |
|
|
proc = Proc.new { |*args| yield *args } |
|
|
proc = Proc.new { |*args| yield(*args) } |
|
|
@block.call(Yielder.new(&proc)) |
|
|
end |
|
|
end |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.