Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyEnumerable and custom eachSingle-choice MCQ

A class includes Enumerable and its each yields elements in the order 3, 1, 2. What does instance.map { |n| n * 2 } return?

class Coll include Enumerable def initialize(*n); @n = n; end def each(&b); @n.each(&b); end end p Coll.new(3, 1, 2).map { |n| n * 2 }