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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tests for hike have a failure because we're not passing the correct block to super. I've extracted a smaller snippet to demonstrate the problem:
class UppercaseArray < Array
def collect!
super do |element|
result = yield element
normalize_element(result)
end
end
def normalize_element(element)
element.upcase
end
end
a = UppercaseArray.new
a.push "a", "b", "c"
a.collect! { |x| x.downcase }
p a
This should print ["A", "B", "C"], but instead prints ["a", "b", "c"].
The block from the collect! call (i.e., the one with x.downcase) is being passed to super and the block attached to the super call is completely ignored.
The text was updated successfully, but these errors were encountered:
The tests for hike have a failure because we're not passing the correct block to
super
. I've extracted a smaller snippet to demonstrate the problem:This should print
["A", "B", "C"]
, but instead prints["a", "b", "c"]
.The block from the
collect!
call (i.e., the one withx.downcase
) is being passed tosuper
and the block attached to thesuper
call is completely ignored.The text was updated successfully, but these errors were encountered: