Ruby: Case-Insensitive Array Comparison

Just found out that this comparison is actually case-sensitive..Anyone know a case-insensitive way of accomplishing the same comparison? -


I don't think there is any "direct" way like the minus operator, but if you don't mind getting all your results in lowercase, you can do this: -

Otherwise you'll have to manually do the comparison using find_all or reject:

signups =
referrals = { |e| signups.include?(e.downcase) }

I'd suggest that reading a reference of Ruby's standard types might help you come up with code like this. For example, "Programming Ruby 1.9" has all methods of the Enumerable object explained starting on page 487 (find_all is on page 489).

Need Your Help

Use a handheld bluetooth printer with android

android printing bluetooth serial-port

I have a bluetooth Handheld printer that I am able to communicate to using a SPP connection from my Mac(using Coolterm).

override a class/add properties to a ListviewItem (

.net properties override

I have a listview but I would like to add 3 properties (for example one of them is "image") to the listviewitems in it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.