Skip to content

Instantly share code, notes, and snippets.

@matti
Last active August 5, 2016 08:05
Show Gist options
  • Select an option

  • Save matti/7063bfc77ed361f81ee8f5701feb58e6 to your computer and use it in GitHub Desktop.

Select an option

Save matti/7063bfc77ed361f81ee8f5701feb58e6 to your computer and use it in GitHub Desktop.
if array of string include substring with reduce
irb(main):040:0> ["abba", "bebbe", "cebbe"].reduce(false) {|a,c| (a || c.include?("xx")) }
=> false
irb(main):041:0> ["abba", "bebbe", "cebbe"].reduce(false) {|a,c| (a || c.include?("bbe")) }
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment