# File lib/dep_selector/densely_packed_set.rb, line 44 def [](constraint) # TODO [cw/mark,2010/11/22]: don't actually need an array here, re-write range = [] started = false done = false sorted_elements.each_with_index do |element, idx| if constraint.include?(element) raise "Currently only handle continuous gap between #{range.last} and #{idx} for #{constraint.to_s} over #{@sorted_elements.join(', ')}" if (range.any? && range.last+1 != idx) range << idx end end range.empty? ? [] : Range.new(range.first, range.last) end
Generated with the Darkfish Rdoc Generator 2.