Sha256: fbf7d5f90a3f81472425ee768c3831f13a3db12d13f9837a4a95531d9df9f98c

Contents?: true

Size: 741 Bytes

Versions: 49

Compression:

Stored size: 741 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
end


class IndexPath

  def self.[] *values
    IndexPath.new values
  end

  def initialize values
    @values = values
  end

  def === other
    return true if super

    if other.is_a? NSIndexPath
      other = other.to_a
    end

    if other.is_a? Enumerable
      ret = true
      other_i = 0
      @values.each do |val|
        next_val = other[other_i]
        other_i += 1
        unless val == true || val === next_val
          ret = false
          break
        end
      end

      return ret
    end
    return false
  end

end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
sugarcube-0.13.4 lib/sugarcube/nsindexpath.rb
sugarcube-0.13.3 lib/sugarcube/nsindexpath.rb
sugarcube-0.13.2 lib/sugarcube/nsindexpath.rb
sugarcube-0.13 lib/sugarcube/nsindexpath.rb
sugarcube-0.12 lib/sugarcube/nsindexpath.rb
sugarcube-0.11.3 lib/sugarcube/nsindexpath.rb
sugarcube-0.11.2 lib/sugarcube/nsindexpath.rb
sugarcube-0.11.1 lib/sugarcube/nsindexpath.rb
sugarcube-0.11 lib/sugarcube/nsindexpath.rb