I use Ruby on Rails v3.2.2, and I would like to call the methods "directly" on the attributes of the instance, and not on their recipient objects. That is, if I have an instance User @userfor which
@user.name
# => "Leonardo da Vinci"
I could implement methods that act directly on the attribute nameso that I can write something like
@user.name.is_correct?
@user.surname.has_char?('V')
Is it possible? If so, how can I do this?
Note. I am trying to implement a plugin.
source
share