I would like to write some new Array methods that modify the calling object, for example:
a = [1,2,3,4]
a.map!{|e| e+1}
a = [2,3,4,5]
... but I'm talking about how to do it. I think I need a new brain.
So, I would like something like this:
class Array
def stuff!
end
end
map! this is just an example, I would like to write a completely new one without using the pre-existing ones! Methods
Thank!
source
share