def my_map result = [] self.each {|i| result << yield(i)} resultend print [1, 2, 3].my_map{|i| i == 2}
Standard input is empty
Standard output is empty
prog.rb:7:in `<main>': private method `my_map' called for [1, 2, 3]:Array (NoMethodError)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!