About Enumerable

l = [1,2,3]
=> [1, 2, 3]

def l.each
puts “l.each called”
super
end
=> :each

l.find {}
l.each called
=> nil

l.reduce {}
l.each called
=> nil

l.select {}
=> []

l.map {}
=> [nil, nil, nil]

Why “l.select {}” and “l.map {}” not call “l.each method” ??

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs