[Newbies] mix ins

Joseph Alotta joseph.alotta at gmail.com
Tue Aug 2 15:03:06 UTC 2016


Greetings,

I want to add a method to the Array class.

#(‘abc’ ‘def’) join =>  ‘abcdef’

#(‘abc’ ‘def’) join: $/ => ‘abc/def’

I am afraid that if I add it to Array directly, it will get lost in a new update.  I want to keep it in my project area.

In ruby, this is called a “mix in”.

How can I do this?

Sincerely,

Joe.





More information about the Beginners mailing list