Flowdock
===(p1) public

Case Equality—Synonym for Regexp#=~ used in case statements.

   a = "HELLO"
   case a
   when /^[a-z]*$/; print "Lower case\n"
   when /^[A-Z]*$/; print "Upper case\n"
   else;            print "Mixed case\n"
   end

produces:

   Upper case
Show source
Register or log in to add new notes.
January 4, 2016 - (>= v1_9_3_392)
0 thanks

Also implemented by other classes

It’s worth noting that this method is also implemented by other classes like Proc, Range and even String.

Most of these are missing proper examples, but you can find some useful examples here:

http://www.blackbytes.info/2015/10/ruby-case/