From: "David N. Springer" Date: 2005-03-29T01:23:49+09:00 Subject: Re: [SOLUTION] English Numerals (#25) Dave Burt wrote: >"James Edward Gray II" suggested: > > >>On Mar 27, 2005, at 7:01 PM, Eliah Hecht wrote: >> >> >>># I'm not really happy about re-defining degree, but I couldn't figure >>># out where to put it so it would be available both places I use it. >>> >>> >>You can just move the definition up to towards the top of the file, so it >>appears before the method that uses it. It when then be available in both >>places. >> >> > >That won't work for the method Integer#to_en. You could make it a constant >(starting with a capital letter, either in Object implicitly or in Integer) >or a global (with a $ in front, these are not usually recommended). > > >class Integer > > DEGREE = [""] + %w[thousand million billion trillion quadrillion > quintillion sextillion septillion octillion nonillion decillion > undecillion duodecillion tredecillion quattuordecillion > quindecillion sexdecillion septdecillion novemdecillion > vigintillion unvigintillion duovigintillion trevigintillion > quattuorvigintillion quinvigintillion sexvigintillion > septvigintillion octovigintillion novemvigintillion trigintillion > untregintillion duotrigintillion googol] > > def teen >.... > result = front.to_en(false) + " " + DEGREE[(self.to_s.length-1)/3] >.... >first_degree = Integer::DEGREE[1..-1].min >.... > >Cheers, >Dave > > > > > what about octodecillion ? -- David N. Springer Phone: (715) 830-1200 Ext. 126 Silicon Logic Engineering, Inc. FAX: (715) 830-1887 7 South Dewey Street, Suite 1 Mailto:springer@siliconlogic.com Eau Claire, WI 54701 Web: http://www.siliconlogic.com