I want to create another name for a method that already exists, e.g. I want to call slice with only. I don’t want to change anything about the behavior of that original method, so it’s not a redefinition, but delegation. How can I do that?
I want to create another name for a method that already exists, e.g. I
Share
There are a number of ways to do that in Ruby. Please check this post which may help you find your most suitable way of doing it.
http://gdakram.com/past/2010/12/2/multiple_ways_in_implementing_delegation_pattern_in_ruby/