Is it possible to alias an attr_reader method in Ruby? I have a class with a favourites property that I want to alias to favorites for American users. What’s the idiomatic Ruby way to do this?
Is it possible to alias an attr_reader method in Ruby? I have a class
Share
attr_reader simply generates appropriate instance methods. This:
is identical to:
therefore, alias_method works as you’d expect it to: