class Numeric
@@currencies = {'yen' => 0.013, 'euro' => 1.292, 'rupee' => 0.019, 'dollar' => 1.0}
def method_missing(method, *args)
singular_currency = (method == :in ? args.first : method).to_s.gsub(/s$/, '')
if @@currencies.has_key?(singular_currency)
self.send(method == :in ? :/ : :*, @@currencies[singular_currency])
else
super
end
end
end
I didn't get the code exactly, I know, it's for the conversion but I'm not getting the ternary operator part.