From: luke gruber Date: 2012-06-25T03:37:41+09:00 Subject: Re: Looking for a better way to add a method to a core class than monkey patching > Here an example method that I use from time to time: > > class String > def integer? > !!(self =~ /\A[+-]?[0-9]+\Z/) > end > end > > Regards, > Marcus Hey, this can be made a bit cleaner by doing: /regex/ === 'string' -Luke -- Posted via http://www.ruby-forum.com/.