I'm very new to Ruby (and OOP as well) and I don't know why the following thing doesn't work in Ruby
I extended the String class with a new method. Easy enough. Now I want to extend the Fixnum class. A String object appears somewhere in the class, but I can't use the method that I defined earlier. Why? Is this normal?
This is the new method for String:
class String
public
def convert
case self
when "0"
"zero"
when "1"
"one"
.
.
.
end
end
end
And I would like to use it at one point when defining a new method for Fixnum.