geomotion 0.13.2 → 0.14.0

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geomotion (0.13.1)
4
+ geomotion (0.14.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -5,10 +5,11 @@ Gem::Specification.new do |s|
5
5
  s.name = "geomotion"
6
6
  s.version = Geomotion::VERSION
7
7
  s.authors = ["Clay Allsopp", "Colin T.A. Gray"]
8
- s.email = ["clay.allsopp@gmail.com", "colinta@gmail.com"]
8
+ s.email = ["clay@usepropeller.com", "colinta@gmail.com"]
9
9
  s.homepage = "https://github.com/clayallsopp/geomotion"
10
10
  s.summary = "A RubyMotion Geometry Wrapper"
11
11
  s.description = "A RubyMotion Geometry Wrapper"
12
+ s.license = 'MIT'
12
13
 
13
14
  s.files = `git ls-files`.split($\)
14
15
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Clay Allsopp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -98,4 +98,10 @@ class CGPoint
98
98
  "#{self.class.name}(#{self.x}, #{self.y})"
99
99
  end
100
100
 
101
+ private
102
+ # this method allows us to do parallel assignment of #x and #y
103
+ def to_ary
104
+ [self.x, self.y]
105
+ end
106
+
101
107
  end
@@ -312,6 +312,7 @@ class CGRect
312
312
  # adjacent rects
313
313
  def above(margin = 0, options={})
314
314
  margin, options = 0, margin if margin.is_a?(NSDictionary)
315
+ margin = options.delete(:margin) if options.key?(:margin)
315
316
 
316
317
  height = options[:height] || self.size.height
317
318
  self.apply({
@@ -321,6 +322,7 @@ class CGRect
321
322
 
322
323
  def below(margin = 0, options={})
323
324
  margin, options = 0, margin if margin.is_a?(NSDictionary)
325
+ margin = options.delete(:margin) if options.key?(:margin)
324
326
 
325
327
  self.apply({
326
328
  down: self.size.height + margin
@@ -329,6 +331,7 @@ class CGRect
329
331
 
330
332
  def before(margin = 0, options={})
331
333
  margin, options = 0, margin if margin.is_a?(NSDictionary)
334
+ margin = options.delete(:margin) if options.key?(:margin)
332
335
 
333
336
  width = options[:width] || self.size.width
334
337
  self.apply({
@@ -338,11 +341,13 @@ class CGRect
338
341
 
339
342
  def beside(margin = 0, options={})
340
343
  margin, options = 0, margin if margin.is_a?(NSDictionary)
344
+ margin = options.delete(:margin) if options.key?(:margin)
341
345
 
342
346
  self.apply({
343
347
  right: self.size.width + margin
344
348
  }.merge(options))
345
349
  end
350
+ alias after beside
346
351
 
347
352
  # these methods create a rect INSIDE the receiver
348
353
 
@@ -416,6 +421,10 @@ private
416
421
  end
417
422
  end
418
423
 
424
+ def to_ary
425
+ [self.origin, self.size]
426
+ end
427
+
419
428
  public
420
429
  def center(absolute = false)
421
430
  cgrect_offset(absolute) + CGPoint.new(self.size.width / 2, self.size.height / 2)
@@ -529,6 +538,7 @@ public
529
538
  end
530
539
 
531
540
  alias grow_right wider
541
+
532
542
  def grow_left(amount, options={})
533
543
  raise "You must specify an amount in `CGRect#grow_left`" unless amount.is_a?(Numeric)
534
544
 
@@ -538,6 +548,7 @@ public
538
548
  end
539
549
 
540
550
  alias grow_down taller
551
+
541
552
  def grow_up(amount, options={})
542
553
  raise "You must specify an amount in `CGRect#grow_up`" unless amount.is_a?(Numeric)
543
554
 
@@ -566,6 +577,7 @@ public
566
577
  end
567
578
 
568
579
  alias shrink_left thinner
580
+
569
581
  def shrink_right(amount, options={})
570
582
  raise "You must specify an amount in `CGRect#shrink_right`" unless amount.is_a?(Numeric)
571
583
 
@@ -575,6 +587,7 @@ public
575
587
  end
576
588
 
577
589
  alias shrink_up shorter
590
+
578
591
  def shrink_down(amount, options={})
579
592
  raise "You must specify an amount in `CGRect#shrink_down`" unless amount.is_a?(Numeric)
580
593
 
@@ -98,4 +98,9 @@ class CGSize
98
98
  "#{self.class.name}(#{self.width}, #{self.height})"
99
99
  end
100
100
 
101
+ private
102
+ def to_ary
103
+ [self.width, self.height]
104
+ end
105
+
101
106
  end
@@ -1,3 +1,3 @@
1
1
  module Geomotion
2
- VERSION = "0.13.2"
2
+ VERSION = "0.14.0"
3
3
  end
@@ -153,4 +153,12 @@ describe "CGPoint" do
153
153
  @point.should != point
154
154
  end
155
155
  end
156
- end
156
+
157
+ describe "#to_ary" do
158
+ it "should allow parallel assigment" do
159
+ x, y = @point
160
+ x.should == 10.0
161
+ y.should == 20.0
162
+ end
163
+ end
164
+ end
@@ -414,6 +414,12 @@ describe "CGRect" do
414
414
  rect.origin.y.should == -10
415
415
  rect.size.height.should == 10
416
416
  end
417
+
418
+ it "works with options and margin as option" do
419
+ rect = CGRect.make(height: 50).above(margin: 20, height: 10)
420
+ rect.origin.y.should == -30
421
+ rect.size.height.should == 10
422
+ end
417
423
  end
418
424
 
419
425
  describe "#below" do
@@ -440,6 +446,12 @@ describe "CGRect" do
440
446
  rect.origin.y.should == 50
441
447
  rect.size.height.should == 10
442
448
  end
449
+
450
+ it "works with options and margin as option" do
451
+ rect = CGRect.make(height: 50).below(margin: 20, height: 10)
452
+ rect.origin.y.should == 70
453
+ rect.size.height.should == 10
454
+ end
443
455
  end
444
456
 
445
457
  describe "#before" do
@@ -466,6 +478,12 @@ describe "CGRect" do
466
478
  rect.origin.x.should == -10
467
479
  rect.size.width.should == 10
468
480
  end
481
+
482
+ it "works with options and margin as option" do
483
+ rect = CGRect.make(width: 50).before(margin: 20, width: 10)
484
+ rect.origin.x.should == -30
485
+ rect.size.width.should == 10
486
+ end
469
487
  end
470
488
 
471
489
  describe "#beside" do
@@ -492,6 +510,12 @@ describe "CGRect" do
492
510
  rect.origin.x.should == 50
493
511
  rect.size.width.should == 10
494
512
  end
513
+
514
+ it "works with options and margin as option" do
515
+ rect = CGRect.make(width: 50).beside(margin: 20, width: 10)
516
+ rect.origin.x.should == 70
517
+ rect.size.width.should == 10
518
+ end
495
519
  end
496
520
 
497
521
  describe "#top_left" do
@@ -1104,4 +1128,12 @@ describe "CGRect" do
1104
1128
  end
1105
1129
  end
1106
1130
 
1131
+ describe "#to_ary" do
1132
+ it "should allow parallel assigment" do
1133
+ position, size = @rect
1134
+ position.should == CGPointMake(10.0, 100.0)
1135
+ size.should == CGSizeMake(50, 20)
1136
+ end
1137
+ end
1138
+
1107
1139
  end
@@ -149,4 +149,12 @@ describe "CGSize" do
149
149
  end
150
150
  end
151
151
 
152
- end
152
+ describe "#to_ary" do
153
+ it "should allow parallel assigment" do
154
+ width, height = @size
155
+ width.should == 100.0
156
+ height.should == 200.0
157
+ end
158
+ end
159
+
160
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geomotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.14.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-08 00:00:00.000000000 Z
13
+ date: 2014-01-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70366710050360 !ruby/object:Gem::Requirement
17
+ requirement: &70274280072720 !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: :development
24
24
  prerelease: false
25
- version_requirements: *70366710050360
25
+ version_requirements: *70274280072720
26
26
  description: A RubyMotion Geometry Wrapper
27
27
  email:
28
- - clay.allsopp@gmail.com
28
+ - clay@usepropeller.com
29
29
  - colinta@gmail.com
30
30
  executables: []
31
31
  extensions: []
@@ -36,6 +36,7 @@ files:
36
36
  - Gemfile
37
37
  - Gemfile.lock
38
38
  - Geomotion.gemspec
39
+ - LICENSE
39
40
  - README.md
40
41
  - Rakefile
41
42
  - app/app_delegate.rb
@@ -57,7 +58,8 @@ files:
57
58
  - spec/cg_rect_spec.rb
58
59
  - spec/cg_size_spec.rb
59
60
  homepage: https://github.com/clayallsopp/geomotion
60
- licenses: []
61
+ licenses:
62
+ - MIT
61
63
  post_install_message:
62
64
  rdoc_options: []
63
65
  require_paths: