Skip to content

Instantly share code, notes, and snippets.

@alloy
Created October 23, 2010 12:43
Show Gist options
  • Save alloy/642166 to your computer and use it in GitHub Desktop.
Save alloy/642166 to your computer and use it in GitHub Desktop.
$ macruby t.rb
2
3
4
5
6
7
[2, 3, 4, 5, 6, 7]
framework 'Foundation'
class NSIndexSet
def each
i = firstIndex
while i != NSNotFound
yield i
i = indexGreaterThanIndex(i)
end
end
include Enumerable
end
indices = NSIndexSet.indexSetWithIndexesInRange(NSMakeRange(2, 6))
indices.each {|i| p i }
p indices.to_a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment