Hi!
I’m developing an localization plugin (just for my own purposes) and I
wanted to extend the to_s method for the Time class.
What I want to do:
when someone does date.to_s(:short) that a localized version of
the :short date is displayed.
But I don’t know how to accomplish this. I know have this:
class Time
def to_s(option)
print option.to_yaml
‘lalo’
end
end
Jepp… it prints all the the times to ‘lalo’
But how do I adjust this method so that only in the case of :short the
return value is modified?
Something like:
if option == :short {
return self.strftime("%Y %D %E")
}
Or is there more to it?
Thanks in advance!