Q:

Use String#end_with?()  but ignore case

How to determine if string ends with another string regardless of its case? 
filename.end_with?(*%w(.ext1 .e2 .extension))

This example only matches if the case matches too.  How to match regardless of the case? 

A:

Change filename to lowercase and compare with lowercase extensions. 
filename.downcase.end_with?(*%w(.ext1 .e2 .extension))

'MAIN.RB'.downcase.end_with?(*%w(.ruby .rb)) # => true

