On 07/12/2012 10:30 PM, sto.mar / web.de wrote:
> Am 12.07.2012 21:46, schrieb Brian Candler:
>> If you just want to allow digits and nothing else, use a regexp:
>> /\A\d+\z/ =~ o
>
> or
>
> /\A\d+\z/ === o
>
> which returns true or false (instead of 0 or nil)

If o is allowed to be a Fixnum, you need to cast to string first:

   /\A\d+\z/ === o.to_s

Alternatively

   !!o.to_s[/\A\d+\z/]

-- 
Lars Haugseth