[Solved] Is multiple include?() arguments in ruby possible?


def coffee_drink?(drink_list)
  %w(coffee espresso).any? { |drink| drink_list.include?(drink) } 
end

or

def coffee_drink?(drink_list)
  (%w(coffee espresso) & drink_list).any?
end

note that your version could be rewritten like this

def coffee_drink?(drink_list)
  drink_list.include?("coffee") || drink_list.include?("espresso")
end

solved Is multiple include?() arguments in ruby possible?