class NSIndexPath
Public Instance Methods
to_a()
click to toggle source
convert to an array of integers
example:
path = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3) path.to_a # => [1, 3]
# File lib/cocoa/sugarcube-foundation/nsindexpath.rb, line 18 def to_a self.length.times.reduce([]) do |a, i| a << self.indexAtPosition(i) end end
to_ary()
click to toggle source
support multiple assignment
example:
a, b = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3) a # => 1 b # => 3
# File lib/cocoa/sugarcube-foundation/nsindexpath.rb, line 9 def to_ary to_a end
to_s()
click to toggle source
Calls superclass method
# File lib/cocoa/sugarcube-to_s/nsindexpath.rb, line 3 def to_s return super unless self.respond_to?(:to_a) "<NSIndexPath #{to_a.to_s}>" end