Sha256: 787dde052c73f2b7eb3a94936c5c434d833719ee7274d7dcd4ac624b4ec12f2c

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

class Array

  def === other
    return other === self if other.is_a? NSIndexPath
    ret = super
    puts("=============== array.rb at line 6 ===============
returning super: #{ret.inspect}")
    ret
  end

  def to_pointer(type)
    ret = Pointer.new(type, self.length)
    self.each_index do |i|
      ret[i] = self[i]
    end
    ret
  end

  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

  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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sugarcube-0.8.1 lib/sugarcube/array.rb
sugarcube-0.8 lib/sugarcube/array.rb