Skip to content

Instantly share code, notes, and snippets.

@bishopandco
Created February 21, 2011 05:54
Show Gist options
  • Save bishopandco/836708 to your computer and use it in GitHub Desktop.
Save bishopandco/836708 to your computer and use it in GitHub Desktop.
require 'set'
data = [ "ss_1111_f1_01_s0_r1", "ss_1111_f1_02_s0", "ss_1111_f1_03_s0", "ss_1111_f1_01_s3", "ss_1111_f1_02_s3", "ss_1111_f1_01_s0_r0" , "ss_1111_f1_03_s3","ss_1111_f1_01_s0"].collect{|d| Set.new(d.split("_")) }
query = Set.new("ss_1111_f1_01_s0_r0_i4".split("_"))
matching_image = data.select {|f| f.subset?( query ) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment