Class: NSIndexSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bean/nsindexset_additions.rb

Overview

Extensions to the NSIndexSet class

Instance Method Summary collapse

Instance Method Details

#each {|i| ... } ⇒ nil

Iterate over each of the items in the NSIndexSet

Examples:

s = NSIndexSet.indexSetWithIndexesInRange(NSMakeRange(0, 10))
s.each { |i| puts i }

Yields:

  • (i)

    Provides the current index to the given block

Yield Parameters:

  • i (Fixnum)

    The index

Returns:

  • (nil)


15
16
17
18
19
20
21
# File 'lib/bean/nsindexset_additions.rb', line 15

def each
  i = self.firstIndex
  until i == NSNotFound
    yield i
    i = self.indexGreaterThanIndex(i)
  end
end