sugarcube 0.7.7 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -49,7 +49,7 @@ Examples
49
49
  -------
50
50
 
51
51
  ```ruby
52
- [1, 3].uiindexpath # NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
52
+ [1, 3].nsindexpath # NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
53
53
  ```
54
54
 
55
55
  Fixnum
@@ -8,7 +8,7 @@ class Array
8
8
  ret
9
9
  end
10
10
 
11
- def uiindexpath
11
+ def nsindexpath
12
12
  if self.length == 0
13
13
  raise "An index path must have at least one index"
14
14
  end
@@ -24,4 +24,16 @@ class Array
24
24
  return path
25
25
  end
26
26
 
27
+ def nsindexset
28
+ if self.length == 0
29
+ raise "An index set must have at least one index"
30
+ end
31
+
32
+ set = NSMutableIndexSet.indexSet
33
+ self.each do |val|
34
+ set.addIndex val
35
+ end
36
+ set
37
+ end
38
+
27
39
  end
@@ -0,0 +1,11 @@
1
+ class NSIndexPath
2
+ def to_a
3
+ indexes_ptr = Pointer.new(:uint, self.length)
4
+ self.getIndexes indexes_ptr
5
+ a = []
6
+ self.length.times do |i|
7
+ a << indexes_ptr[i]
8
+ end
9
+ a
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class NSIndexSet
2
+ def to_a
3
+ a = []
4
+ self.enumerateIndexesUsingBlock(
5
+ lambda do |idx, stop_ptr|
6
+ a << idx
7
+ end
8
+ )
9
+ a
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.7.7'
2
+ Version = '0.7.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70351241731560 !ruby/object:Gem::Requirement
17
+ requirement: &70196039902580 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70351241731560
25
+ version_requirements: *70196039902580
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70351241730920 !ruby/object:Gem::Requirement
28
+ requirement: &70196039901960 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70351241730920
36
+ version_requirements: *70196039901960
37
37
  description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
38
38
  make
39
39
 
@@ -72,6 +72,8 @@ files:
72
72
  - lib/sugarcube/exceptions.rb
73
73
  - lib/sugarcube/fixnum.rb
74
74
  - lib/sugarcube/notifications.rb
75
+ - lib/sugarcube/nsindexpath.rb
76
+ - lib/sugarcube/nsindexset.rb
75
77
  - lib/sugarcube/nsstring.rb
76
78
  - lib/sugarcube/nsurl.rb
77
79
  - lib/sugarcube/numeric.rb