That's OK because in Ruby 0 is true!  (Only nil and false are false)

 

From: ironruby-core-boun...@rubyforge.org
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of cdur...@tsys.com
Sent: 10 July 2009 16:21
To: ironruby-core@rubyforge.org
Cc: ironruby-core@rubyforge.org; ironruby-core-boun...@rubyforge.org
Subject: Re: [Ironruby-core] Use of case operator

 


Sorry, yes, I know about the =~ operator, but I believe that returns an
integer (the position of the first match) or nil, not a Boolean as I
require. 

-- Chuck 

-- 
Chuck Durfee 
Sr. Internet Software Developer 
TSYS iSolutions, Golden 
Email cdur...@tsys.com 





Kibiz0r <kibi...@gmail.com> 
Sent by: ironruby-core-boun...@rubyforge.org 

07/10/2009 09:07 AM 


Please respond to
ironruby-core@rubyforge.org


To

ironruby-core@rubyforge.org 


cc

        

Subject

Re: [Ironruby-core] Use of case operator

 

                




Chuck,

Yes, there's an operator just for this scenario!

The regular expression operator: =~

Mike

On Fri, Jul 10, 2009 at 10:34 AM, <cdur...@tsys.com> wrote: 

I'm fairly new to Ruby, and I have a usage question. 

There are times when I want to know if a regular expression matches a given
input.  For example: 

class String 
       def containsVowel? 
               /[AEIOU]/i === self 
       end 
end 

Is there a common Ruby idiom for this, or is using the case operator this
way the norm? 

-- Chuck 

-- 
Chuck Durfee 
Sr. Internet Software Developer 
TSYS iSolutions, Golden 
Email  <mailto:cdur...@tsys.com> cdur...@tsys.com 

  _____  

The information contained in this communication (including any attachments
hereto) is confidential and is intended solely for the personal and
confidential use of the individual or entity to whom it is addressed. If the
reader of this message is not the intended recipient or an agent responsible
for delivering it to the intended recipient, you are hereby notified that
you have received this communication in error and that any review,
dissemination, copying, or unauthorized use of this information, or the
taking of any action in reliance on the contents of this information is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
Thank you 


_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core




-- 
Michael Harrington | Software Apprentice
Atomic Object | http://atomicobject.com <http://atomicobject.com/> 
[Ph] +1 616 776 6020 [Fx] +1 616 776
6015_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

  _____  

The information contained in this communication (including any attachments
hereto) is confidential and is intended solely for the personal and
confidential use of the individual or entity to whom it is addressed. If the
reader of this message is not the intended recipient or an agent responsible
for delivering it to the intended recipient, you are hereby notified that
you have received this communication in error and that any review,
dissemination, copying, or unauthorized use of this information, or the
taking of any action in reliance on the contents of this information is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
Thank you 

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/09/09
18:07:00

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to