From: sto.mar@... Date: 2012-06-25T04:20:58+09:00 Subject: Re: Looking for a better way to add a method to a core class than monkey patching Am 24.06.2012 20:37, schrieb luke gruber: >> 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' Nice! (Naturally, I tried 'string' === /regex/ first, which of course does not work...) Regards, Marcus --