From: Jp Hastings-spital Date: 2009-05-22T00:11:53+09:00 Subject: Extending Float Maybe I haven't wrapped my head around OOP in the way I should have, can anyone explain to me why I can't do this?: -- class Percentage < Float def to_s(decimalplaces = 0) (((self * 10**(decimalplaces+2)).round)/10**decimalplaces).to_s+"%" end end puts Percentage.new(0.5) -- I just get the following error: NoMethodError: undefined method ‘new’ for Percentage:Class I hope its obvious what I'm trying to do, let me know if there's a way to achieve this that I'm missing! Thanks in advance -- Posted via http://www.ruby-forum.com/.