fork download
  1. def my_map
  2. result = []
  3. self.each {|i| result << yield(i)}
  4. result
  5. end
  6.  
  7. print [1, 2, 3].my_map{|i| i == 2}
Runtime error #stdin #stdout #stderr 0.05s 9704KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:7:in `<main>': private method `my_map' called for [1, 2, 3]:Array (NoMethodError)