lib/sugarcube/array.rb in sugarcube-0.7.7 vs lib/sugarcube/array.rb in sugarcube-0.7.9

- old
+ new

@@ -6,11 +6,11 @@ ret[i] = self[i] end ret end - def uiindexpath + def nsindexpath if self.length == 0 raise "An index path must have at least one index" end path = nil @@ -20,8 +20,20 @@ else path = NSIndexPath.indexPathWithIndex(val) end end return path + end + + def nsindexset + if self.length == 0 + raise "An index set must have at least one index" + end + + set = NSMutableIndexSet.indexSet + self.each do |val| + set.addIndex val + end + set end end