sugarcube 2.12.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d99623279065213aca003e13dcc59448c886e7b8
4
- data.tar.gz: 582bef5540fe232572381f1638740fffdab17e82
3
+ metadata.gz: 999290491d22cfd213d4ecb5ab34593a7570bb0d
4
+ data.tar.gz: 94c4d0c38097de09640eb5d12611508494590573
5
5
  SHA512:
6
- metadata.gz: 97665c180eb52eb7c7fef919fcf8e3db833703f4d95b6e0bbe41b6a3167987afcf8d6d673794297433f09ff71a54ba226cb951ade265d42658603cf967fb453c
7
- data.tar.gz: 2c991dd2d0268167f8b776a5ed7900aa6bf39f48ad4465eb29c12e9fc318bfcd6bcf0b4f55b5a16cd40c4bb488646dd000ce7fb53f673f589277fea92c3ccfc6
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>?".attributed_html
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
- indexes_ptr = Pointer.new(:uint, self.length)
5
- self.getIndexes indexes_ptr
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
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '2.12.0'
2
+ Version = '2.12.1'
3
3
  end
@@ -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.0
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 00:00:00.000000000 Z
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