Module: NSIndexPathWrap

Defined in:
motion/core/ns_index_path.rb

Instance Method Summary (collapse)

Instance Method Details

- (Integer) [](position)

Gives access to an index at a given position.

Parameters:

  • position (Integer)

    to use to fetch the index

Returns:

  • (Integer)

    the index for the given position

Raises:

  • (ArgumentError)


6
7
8
9
# File 'motion/core/ns_index_path.rb', line 6

def [](position)
  raise ArgumentError unless position.is_a?(Integer)
  indexAtPosition(position)
end

- (NSIndexPath) each

Provides an iterator taking a block following the common Ruby idiom.

Parameters:

  • (Block)

Returns:

  • (NSIndexPath)

    the iterated object itself



14
15
16
17
18
19
20
21
# File 'motion/core/ns_index_path.rb', line 14

def each
  i = 0
  until i == self.length
    yield self.indexAtPosition(i)
    i += 1
  end
  self
end