sugarcube 2.12.0 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/cocoa/sugarcube-foundation/nsindexpath.rb +17 -6
- data/lib/version.rb +1 -1
- data/spec/cocoa/nsindexpath_spec.rb +14 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999290491d22cfd213d4ecb5ab34593a7570bb0d
|
4
|
+
data.tar.gz: 94c4d0c38097de09640eb5d12611508494590573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 535d15fdc74e96a9c2b10625503544eeb7e19c8340b3731fa8f9c9c94bd4eb3d5622240854cfc03299c1eead7fa5ddc4478620e7c6d1784e9757eec3151804d6
|
7
|
+
data.tar.gz: 85ebc4b8fcce22d74089cc97e1f78afb5518fa89633cc174f813de28200812241295f1dfa45f3f3dbfa90f2a642587141ad0209f37974bc874dc612379be3846
|
data/README.md
CHANGED
@@ -1252,7 +1252,7 @@ issues with missing constants).
|
|
1252
1252
|
|
1253
1253
|
# You can even generate attributed text from html! This feature uses the
|
1254
1254
|
# NSHTMLTextDocumentType option to convert the html to NSAttributedString
|
1255
|
-
'Why on <b>earth<b> would you want to do <em>that</em>?
|
1255
|
+
'Why on <b>earth<b> would you want to do <em>that</em>?'.attributed_html
|
1256
1256
|
```
|
1257
1257
|
|
1258
1258
|
And you can easily turn an attributed string into a label, if you include the
|
@@ -1,13 +1,24 @@
|
|
1
1
|
class NSIndexPath
|
2
2
|
|
3
|
+
# support multiple assignment
|
4
|
+
#
|
5
|
+
# example:
|
6
|
+
# a, b = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
|
7
|
+
# a # => 1
|
8
|
+
# b # => 3
|
9
|
+
def to_ary
|
10
|
+
to_a
|
11
|
+
end
|
12
|
+
|
13
|
+
# convert to an array of integers
|
14
|
+
#
|
15
|
+
# example:
|
16
|
+
# path = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
|
17
|
+
# path.to_a # => [1, 3]
|
3
18
|
def to_a
|
4
|
-
|
5
|
-
|
6
|
-
a = []
|
7
|
-
self.length.times do |i|
|
8
|
-
a << indexes_ptr[i]
|
19
|
+
self.length.times.reduce([]) do |a, i|
|
20
|
+
a << self.indexAtPosition(i)
|
9
21
|
end
|
10
|
-
a
|
11
22
|
end
|
12
23
|
|
13
24
|
end
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
describe NSIndexPath do
|
2
|
+
|
3
|
+
it 'should have to_a' do
|
4
|
+
path = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
|
5
|
+
path.to_a.should == [1, 3]
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should have to_ary' do
|
9
|
+
a, b = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
|
10
|
+
a.should == 1
|
11
|
+
b.should == 3
|
12
|
+
end
|
13
|
+
|
14
|
+
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: 2.12.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-11-
|
14
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |
|
17
17
|
== Description
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- spec/cocoa/nscoder_spec.rb
|
221
221
|
- spec/cocoa/nsdata_files_spec.rb
|
222
222
|
- spec/cocoa/nsdictionary_files_spec.rb
|
223
|
+
- spec/cocoa/nsindexpath_spec.rb
|
223
224
|
- spec/cocoa/numeric_time_spec.rb
|
224
225
|
- spec/cocoa/spritekit_spec.rb
|
225
226
|
- spec/cocoa/timer_spec.rb
|
@@ -317,6 +318,7 @@ test_files:
|
|
317
318
|
- spec/cocoa/nscoder_spec.rb
|
318
319
|
- spec/cocoa/nsdata_files_spec.rb
|
319
320
|
- spec/cocoa/nsdictionary_files_spec.rb
|
321
|
+
- spec/cocoa/nsindexpath_spec.rb
|
320
322
|
- spec/cocoa/numeric_time_spec.rb
|
321
323
|
- spec/cocoa/spritekit_spec.rb
|
322
324
|
- spec/cocoa/timer_spec.rb
|