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.18.9 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.8 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.7 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.6 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.5 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.4 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.3 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.2 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.1 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.0 lib/sugarcube/nsindexpath.rb
sugarcube-0.16.9 lib/sugarcube/nsindexpath.rb
sugarcube-0.16.5 lib/sugarcube/nsindexpath.rb
sugarcube-0.16.2 lib/sugarcube/nsindexpath.rb
sugarcube-0.16 lib/sugarcube/nsindexpath.rb
sugarcube-0.15.5 lib/sugarcube/nsindexpath.rb
sugarcube-0.15.3 lib/sugarcube/nsindexpath.rb
sugarcube-0.15.0 lib/sugarcube/nsindexpath.rb
sugarcube-0.14.0 lib/sugarcube/nsindexpath.rb
sugarcube-0.13.7 lib/sugarcube/nsindexpath.rb
sugarcube-0.13.5 lib/sugarcube/nsindexpath.rb