I was wondering if there was a dry way of writing the following in Ruby:
ext == ".xlsx" || ext == ".xls" || ext == ".ods"
My initial thought was the following which doesn't seem to work as expected:
ext == ".xlsx" || ".xls" || ".ods"
Yes, there is...
['.xlsx','.xls','.ods'].include? ext
%w(.xlsx .xls .ods).include? ext
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With