Sha256: f3b7d5cf0c9e37e99fe1643b822d5cc8d7b42f813d695aa5b27b6e50aae04111

Contents?: true

Size: 789 Bytes

Versions: 23

Compression:

Stored size: 789 Bytes

Contents

class NSArray

  # Creates an NSIndexPath object using the items in `self` as the indices
  # @return [NSIndexPath]
  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

  # Creates an NSIndexSet object using the items in `self` as the indices
  # @return [NSIndexSet]
  def nsindexset
    if self.length == 0
      raise "An index set must have at least one index"
    end

    set = NSMutableIndexSet.indexSet
    self.each do |val|
      set.addIndex val
    end
    set
  end

  def nsset
    NSSet.setWithArray self
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
sugarcube-1.4.1 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.4.0 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.11 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.10 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.9 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.8 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.7 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.6 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.5 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.4 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.3 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.2 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.1 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.3.0 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.1.0 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.0.7 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.0.6 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.0.5 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.0.4 lib/sugarcube-foundation/nsarray.rb
sugarcube-1.0.3 lib/sugarcube-foundation/nsarray.rb