From: Aldric Giacomoni Date: 2009-10-31T02:32:25+09:00 Subject: Re: How do you get the tail end of a string? Bertram Scharpf wrote: > It's just a few lines of code. It's pure logic when you > have Numeric#nonzero? and it's very useful to build default > values: > > str.notempty? || "(none)" # analoigous to SQL-coalesce() > > I guess it would be more useful than flip-flops or class variables. > > Bertram Bertram, So do like everyone else and extend the language to your liking ;-) I have a small custom Rails app here which has the following in an Integer.rb file, under /lib : class Integer def to_hours self / 3600 end end Because I needed that (yes - just like that, no floating point division) and it wasn't in Ruby. -- Posted via http://www.ruby-forum.com/.