Class: IndexPath

Inherits:
Object show all
Defined in:
lib/sugarcube/nsindexpath.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ IndexPath

Returns a new instance of IndexPath.



20
21
22
# File 'lib/sugarcube/nsindexpath.rb', line 20

def initialize values
  @values = values
end

Class Method Details

.[](*values) ⇒ Object



16
17
18
# File 'lib/sugarcube/nsindexpath.rb', line 16

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

Instance Method Details

#===(other) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/sugarcube/nsindexpath.rb', line 24

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