Tag: ruby

Ruby .detect array function

When i search items in an array in Ruby, I usually go with the select method, and get the first item it finds. result = [3, 5, 1.3, ‘sample text’, nil, 7].select{|item| item.is_a?(Integer) }.first The problem I have with using select is it always …