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.20.7 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.6 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.5 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.4 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.3 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.1 lib/sugarcube/nsindexpath.rb
sugarcube-0.20.0 lib/sugarcube/nsindexpath.rb
sugarcube-0.19.5 lib/sugarcube/nsindexpath.rb
sugarcube-0.19.4 lib/sugarcube/nsindexpath.rb
sugarcube-0.19.2 lib/sugarcube/nsindexpath.rb
sugarcube-0.19.0 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.21 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.20 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.19 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.18 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.17 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.16 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.12 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.11 lib/sugarcube/nsindexpath.rb
sugarcube-0.18.10 lib/sugarcube/nsindexpath.rb