Sha256: 5a726c5ef484aa49e9fd1598e1413d7a0b248443d163e47b5c333d30c236d3ec

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

class NSIndexPath
  def to_a
    indexes_ptr = Pointer.new(:uint, self.length)
    self.getIndexes indexes_ptr
    a = []
    self.length.times do |i|
      a << indexes_ptr[i]
    end
    a
  end

  def === other
    return true if super

    if other.is_a? Enumerable
      ret = true
      path = self.to_a
      other.each do |val|
        unless val === path.shift
          ret = false
          break
        end
      end

      return ret
    end
    return false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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