Method: NSArray#nsindexpath

Defined in:
lib/cocoa/sugarcube-foundation/nsarray.rb

#nsindexpathNSIndexPath

Creates an NSIndexPath object using the items in self as the indices

Returns:



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cocoa/sugarcube-foundation/nsarray.rb', line 5

def nsindexpath
  if self.length == 0
    raise "An index path must have at least one index"
  end

  path = nil
  self.each do |val|
    if path
      path = path.indexPathByAddingIndex(val)
    else
      path = NSIndexPath.indexPathWithIndex(val)
    end
  end
  return path
end