geomotion 0.12.3 → 0.13.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.12.3)
4
+ geomotion (0.13.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -189,6 +189,26 @@ frame.top_center(true) # => [15, 10]
189
189
  frame.bottom_right(true) # => [20, 20]
190
190
  ```
191
191
 
192
+ #### The great and powerful `apply` method
193
+
194
+ All of the methods that return a new frame (`left, shrink, below` and friends)
195
+ also accept a hash in which you can apply more changes. You can accomplish the
196
+ same thing using method chaining; this is an implementation detail that might
197
+ also clean your code up by grouping changes. And, of course, it can be used on
198
+ its own as well.
199
+
200
+ ```ruby
201
+ frame = CGRect.make(x: 10, y: 10, width:10, height: 10)
202
+ frame.beside.width(20).down(10).height(20)
203
+ # => [[20, 20], [20, 20]]
204
+ # or, using the options hash
205
+ frame.beside(width: 20, down: 10, height: 20)
206
+
207
+ # there are some changes that don't have a corresponding method:
208
+ frame.below(grow_width: 10, grow_up: 5)
209
+ # => [[0, 15], [40, 25]]
210
+ ```
211
+
192
212
  ### CGSize
193
213
 
194
214
  ```ruby
@@ -1,4 +1,5 @@
1
1
  class CGPoint
2
+
2
3
  # CGPoint.make(x: 10, y: 30)
3
4
  def self.make(options = {})
4
5
  CGPoint.new(options[:x] || 0, options[:y] || 0)
@@ -1,4 +1,5 @@
1
1
  class CGRect
2
+
2
3
  # CGRect.make # default rect: {origin: {x: 0, y: 0}, size: {width:0, height:0}}
3
4
  # # aka CGRectZero
4
5
  # CGRect.make(x: 10, y: 30) # default size: [0, 0]
@@ -100,7 +101,7 @@ class CGRect
100
101
  # getters/setters
101
102
  def x(setter = nil)
102
103
  if setter
103
- return CGRect.new([setter, self.y], self.size)
104
+ return CGRect.new([setter, self.origin.y], self.size)
104
105
  end
105
106
  min_x
106
107
  end
@@ -111,7 +112,7 @@ class CGRect
111
112
 
112
113
  def y(setter = nil)
113
114
  if setter
114
- return CGRect.new([self.x, setter], self.size)
115
+ return CGRect.new([self.origin.x, setter], self.size)
115
116
  end
116
117
  min_y
117
118
  end
@@ -122,7 +123,7 @@ class CGRect
122
123
 
123
124
  def width(setter = nil)
124
125
  if setter
125
- return CGRect.new(self.origin, [setter, self.height])
126
+ return CGRect.new(self.origin, [setter, self.size.height])
126
127
  end
127
128
  CGRectGetWidth(self)
128
129
  end
@@ -133,7 +134,7 @@ class CGRect
133
134
 
134
135
  def height(setter = nil)
135
136
  if setter
136
- return CGRect.new(self.origin, [self.width, setter])
137
+ return CGRect.new(self.origin, [self.size.width, setter])
137
138
  end
138
139
  CGRectGetHeight(self)
139
140
  end
@@ -142,70 +143,134 @@ class CGRect
142
143
  self.size.height = _height
143
144
  end
144
145
 
145
- # modified rects
146
- def left(dist = 0)
147
- CGRect.new([self.x - dist, self.y], self.size)
148
- end
149
-
150
- def right(dist = 0)
151
- CGRect.new([self.x + dist, self.y], self.size)
152
- end
153
-
154
- def up(dist = 0)
155
- CGRect.new([self.x, self.y - dist], self.size)
156
- end
157
-
158
- def down(dist = 0)
159
- CGRect.new([self.x, self.y + dist], self.size)
146
+ # most rect modifiers call this method in one way or another
147
+ def apply(options)
148
+ rect = CGRectStandardize(CGRect.new(self.origin, self.size))
149
+ options.each do |method, value|
150
+ case method
151
+ when :left
152
+ rect.origin.x -= value
153
+ when :right
154
+ rect.origin.x += value
155
+ when :up
156
+ rect.origin.y -= value
157
+ when :down
158
+ rect.origin.y += value
159
+ when :wider, :grow_right
160
+ rect.size.width += value
161
+ when :thinner, :shrink_left
162
+ rect.size.width -= value
163
+ when :taller, :grow_down
164
+ rect.size.height += value
165
+ when :shorter, :shrink_up
166
+ rect.size.height -= value
167
+ when :x
168
+ rect.origin.x = value
169
+ when :y
170
+ rect.origin.y = value
171
+ when :origin
172
+ rect.origin = value
173
+ when :width
174
+ rect.size.width = value
175
+ when :height
176
+ rect.size.height = value
177
+ when :size
178
+ rect.size = value
179
+ when :grow
180
+ rect = rect.grow(value)
181
+ when :grow_up
182
+ rect.size.height += value
183
+ rect.origin.y -= value
184
+ when :shrink_down
185
+ rect.size.height -= value
186
+ rect.origin.y += value
187
+ when :grow_left
188
+ rect.size.width += value
189
+ rect.origin.x -= value
190
+ when :shrink_right
191
+ rect.size.width -= value
192
+ rect.origin.x += value
193
+ when :grow_width
194
+ rect = rect.grow([value, 0])
195
+ when :grow_height
196
+ rect = rect.grow([0, value])
197
+ when :shrink
198
+ rect = rect.shrink(value)
199
+ when :shrink_width
200
+ rect = rect.shrink([value, 0])
201
+ when :shrink_height
202
+ rect = rect.shrink([0, value])
203
+ when :offset
204
+ rect = rect.offset(value)
205
+ else
206
+ raise "Unknow option #{method}"
207
+ end
208
+ end
209
+ return rect
160
210
  end
161
211
 
162
- def wider(dist)
163
- CGRect.new(self.origin, [self.width + dist, self.height])
212
+ # modified rects
213
+ def left(dist = 0, options={})
214
+ options[:left] = dist
215
+ self.apply(options)
164
216
  end
165
217
 
166
- def thinner(dist)
167
- CGRect.new(self.origin, [self.width - dist, self.height])
218
+ def right(dist = 0, options={})
219
+ options[:right] = dist
220
+ self.apply(options)
168
221
  end
169
222
 
170
- def taller(dist)
171
- CGRect.new(self.origin, [self.width, self.height + dist])
223
+ def up(dist = 0, options={})
224
+ options[:up] = dist
225
+ self.apply(options)
172
226
  end
173
227
 
174
- def shorter(dist)
175
- CGRect.new(self.origin, [self.width, self.height - dist])
228
+ def down(dist = 0, options={})
229
+ options[:down] = dist
230
+ self.apply(options)
176
231
  end
177
232
 
178
- # adjacent rects
179
- def above(margin = 0)
180
- self.above(margin, height:self.height)
233
+ def wider(dist, options={})
234
+ options[:wider] = dist
235
+ self.apply(options)
181
236
  end
182
237
 
183
- def above(margin, height:height)
184
- CGRect.new([self.x, self.y - height - margin], [self.width, height])
238
+ def thinner(dist, options={})
239
+ options[:thinner] = dist
240
+ self.apply(options)
185
241
  end
186
242
 
187
- def below(margin = 0)
188
- self.below(margin, height:self.height)
243
+ def taller(dist, options={})
244
+ options[:taller] = dist
245
+ self.apply(options)
189
246
  end
190
247
 
191
- def below(margin, height:height)
192
- CGRect.new([self.x, self.y + self.height + margin], [self.width, height])
248
+ def shorter(dist, options={})
249
+ options[:shorter] = dist
250
+ self.apply(options)
193
251
  end
194
252
 
195
- def before(margin = 0)
196
- self.before(margin, width:self.width)
253
+ # adjacent rects
254
+ def above(margin = 0, options={})
255
+ height = options[:height] || self.size.height
256
+ options[:up] = height + margin
257
+ self.apply(options)
197
258
  end
198
259
 
199
- def before(margin, width:width)
200
- CGRect.new([self.x - width - margin, self.y], [width, self.height])
260
+ def below(margin = 0, options={})
261
+ options[:down] = self.size.height + margin
262
+ self.apply(options)
201
263
  end
202
264
 
203
- def beside(margin = 0)
204
- self.beside(margin, width: self.width)
265
+ def before(margin = 0, options={})
266
+ width = options[:width] || self.size.width
267
+ options[:left] = width + margin
268
+ self.apply(options)
205
269
  end
206
270
 
207
- def beside(margin, width:width)
208
- CGRect.new([self.x + self.width + margin, self.y], [width, self.height])
271
+ def beside(margin = 0, options={})
272
+ options[:right] = self.size.width + margin
273
+ self.apply(options)
209
274
  end
210
275
 
211
276
  # positions
@@ -220,7 +285,7 @@ private
220
285
 
221
286
  public
222
287
  def center(absolute = false)
223
- cgrect_offset(absolute) + CGPoint.new(self.width / 2, self.height / 2)
288
+ cgrect_offset(absolute) + CGPoint.new(self.size.width / 2, self.size.height / 2)
224
289
  end
225
290
 
226
291
  def top_left(absolute = false)
@@ -228,36 +293,36 @@ public
228
293
  end
229
294
 
230
295
  def top_center(absolute = false)
231
- cgrect_offset(absolute) + CGPoint.new(self.width / 2, 0)
296
+ cgrect_offset(absolute) + CGPoint.new(self.size.width / 2, 0)
232
297
  end
233
298
 
234
299
  def top_right(absolute = false)
235
- cgrect_offset(absolute) + CGPoint.new(self.width, 0)
300
+ cgrect_offset(absolute) + CGPoint.new(self.size.width, 0)
236
301
  end
237
302
 
238
303
  def center_right(absolute = false)
239
- cgrect_offset(absolute) + CGPoint.new(self.width, self.height / 2)
304
+ cgrect_offset(absolute) + CGPoint.new(self.size.width, self.size.height / 2)
240
305
  end
241
306
 
242
307
  def bottom_right(absolute = false)
243
- cgrect_offset(absolute) + CGPoint.new(self.width, self.height)
308
+ cgrect_offset(absolute) + CGPoint.new(self.size.width, self.size.height)
244
309
  end
245
310
 
246
311
  def bottom_center(absolute = false)
247
- cgrect_offset(absolute) + CGPoint.new(self.width / 2, self.height)
312
+ cgrect_offset(absolute) + CGPoint.new(self.size.width / 2, self.size.height)
248
313
  end
249
314
 
250
315
  def bottom_left(absolute = false)
251
- cgrect_offset(absolute) + CGPoint.new(0, self.height)
316
+ cgrect_offset(absolute) + CGPoint.new(0, self.size.height)
252
317
  end
253
318
 
254
319
  def center_left(absolute = false)
255
- cgrect_offset(absolute) + CGPoint.new(0, self.height / 2)
320
+ cgrect_offset(absolute) + CGPoint.new(0, self.size.height / 2)
256
321
  end
257
322
 
258
323
  # others
259
324
  def round
260
- CGRect.new([self.x.round, self.y.round], [self.width.round, self.height.round])
325
+ CGRect.new([self.origin.x.round, self.origin.y.round], [self.size.width.round, self.size.height.round])
261
326
  end
262
327
 
263
328
  def centered_in(rect, absolute = false)
@@ -269,7 +334,7 @@ public
269
334
  when CGRect
270
335
  return self.union_with(other)
271
336
  when CGSize
272
- return CGRect.new([self.x, self.y], [self.width + other.width, self.height + other.height])
337
+ return CGRect.new([self.origin.x, self.origin.y], [self.size.width + other.width, self.size.height + other.height])
273
338
  when CGPoint
274
339
  return self.offset(other.x, other.y)
275
340
  when UIOffset
@@ -319,18 +384,26 @@ public
319
384
  end
320
385
  end
321
386
 
322
- def grow(size)
387
+ def grow(size, options=nil)
323
388
  if size.is_a? Numeric
324
389
  size = CGSize.new(size, size)
325
390
  end
326
- CGRectInset(self, -size[0], -size[1])
391
+ rect = CGRectInset(self, -size[0], -size[1])
392
+ if options
393
+ return rect.apply(options)
394
+ end
395
+ return rect
327
396
  end
328
397
 
329
- def shrink(size)
398
+ def shrink(size, options=nil)
330
399
  if size.is_a? Numeric
331
400
  size = CGSize.new(size, size)
332
401
  end
333
- CGRectInset(self, size[0], size[1])
402
+ rect = CGRectInset(self, size[0], size[1])
403
+ if options
404
+ return rect.apply(options)
405
+ end
406
+ return rect
334
407
  end
335
408
 
336
409
  def empty?
@@ -1,3 +1,3 @@
1
1
  module Geomotion
2
- VERSION = "0.12.3"
2
+ VERSION = "0.13.0"
3
3
  end
@@ -158,7 +158,7 @@ describe "CGRect" do
158
158
  it "returns copy when has args" do
159
159
  rect = @rect.x(20)
160
160
  rect.is_a?(CGRect).should == true
161
- CGRectEqualToRect(rect, CGRectMake(20, 100, 50, 20)).should == true
161
+ rect.should == CGRectMake(20, 100, 50, 20)
162
162
  end
163
163
  end
164
164
 
@@ -183,7 +183,7 @@ describe "CGRect" do
183
183
  it "returns copy when has args" do
184
184
  rect = @rect.y(20)
185
185
  rect.is_a?(CGRect).should == true
186
- CGRectEqualToRect(rect, CGRectMake(10, 20, 50, 20)).should == true
186
+ rect.should == CGRectMake(10, 20, 50, 20)
187
187
  end
188
188
  end
189
189
 
@@ -206,7 +206,7 @@ describe "CGRect" do
206
206
  it "returns copy when has args" do
207
207
  rect = @rect.width(20)
208
208
  rect.is_a?(CGRect).should == true
209
- CGRectEqualToRect(rect, CGRectMake(10, 100, 20, 20)).should == true
209
+ rect.should == CGRectMake(10, 100, 20, 20)
210
210
  end
211
211
  end
212
212
 
@@ -229,7 +229,7 @@ describe "CGRect" do
229
229
  it "returns copy when has args" do
230
230
  rect = @rect.height(50)
231
231
  rect.is_a?(CGRect).should == true
232
- CGRectEqualToRect(rect, CGRectMake(10, 100, 50, 50)).should == true
232
+ rect.should == CGRectMake(10, 100, 50, 50)
233
233
  end
234
234
  end
235
235
 
@@ -608,50 +608,50 @@ describe "CGRect" do
608
608
  it "works with CGRect" do
609
609
  _rect = CGRectMake(10, 100, 50, 20)
610
610
  rect = (_rect + CGRectMake(0, 0, 50, 110))
611
- CGRectEqualToRect(rect, CGRectMake(0, 0, 60, 120)).should == true
611
+ rect.should == CGRectMake(0, 0, 60, 120)
612
612
  end
613
613
 
614
614
  it "works with CGSize" do
615
615
  size = CGSizeMake(50, 20)
616
616
  rect = (@rect + size)
617
- CGRectEqualToRect(rect, CGRectMake(10, 100, 100, 40)).should == true
617
+ rect.should == CGRectMake(10, 100, 100, 40)
618
618
  end
619
619
 
620
620
  it "works with CGPoint" do
621
621
  point = CGPointMake(50, 20)
622
622
  rect = (@rect + point)
623
- CGRectEqualToRect(rect, CGRectMake(60, 120, 50, 20)).should == true
623
+ rect.should == CGRectMake(60, 120, 50, 20)
624
624
  end
625
625
 
626
626
  it "works with UIOffset" do
627
627
  offset = UIOffsetMake(50, 20)
628
628
  rect = (@rect + offset)
629
- CGRectEqualToRect(rect, CGRectMake(60, 120, 50, 20)).should == true
629
+ rect.should == CGRectMake(60, 120, 50, 20)
630
630
  end
631
631
 
632
632
  it "works with UIEdgeInsets" do
633
633
  insets = UIEdgeInsetsMake(10, 10, 10, 5)
634
634
  rect = (@rect + insets)
635
- CGRectEqualToRect(rect, CGRectMake(20, 110, 35, 0)).should == true
635
+ rect.should == CGRectMake(20, 110, 35, 0)
636
636
  end
637
637
  end
638
638
 
639
639
  describe "offset" do
640
640
  it "works with x, y" do
641
641
  rect = @rect.offset(50, 20)
642
- CGRectEqualToRect(rect, CGRectMake(60, 120, 50, 20)).should == true
642
+ rect.should == CGRectMake(60, 120, 50, 20)
643
643
  end
644
644
 
645
645
  it "works with CGPoint" do
646
646
  point = CGPointMake(50, 20)
647
647
  rect = @rect.offset(point)
648
- CGRectEqualToRect(rect, CGRectMake(60, 120, 50, 20)).should == true
648
+ rect.should == CGRectMake(60, 120, 50, 20)
649
649
  end
650
650
 
651
651
  it "works with UIOffset" do
652
652
  offset = UIOffsetMake(50, 20)
653
653
  rect = @rect.offset(offset)
654
- CGRectEqualToRect(rect, CGRectMake(60, 120, 50, 20)).should == true
654
+ rect.should == CGRectMake(60, 120, 50, 20)
655
655
  end
656
656
  end
657
657
 
@@ -659,7 +659,7 @@ describe "CGRect" do
659
659
  it "works with UIEdgeInsets" do
660
660
  insets = UIEdgeInsetsMake(10, 10, 10, 5)
661
661
  rect = @rect.inset(insets)
662
- CGRectEqualToRect(rect, CGRectMake(20, 110, 35, 0)).should == true
662
+ rect.should == CGRectMake(20, 110, 35, 0)
663
663
  end
664
664
  end
665
665
 
@@ -686,7 +686,7 @@ describe "CGRect" do
686
686
  lower_rect = CGRectMake(0, 0, 100, 100)
687
687
  upper_rect = CGRectMake(10, 10, 100, 100)
688
688
  rect = lower_rect.intersection_with(upper_rect)
689
- CGRectEqualToRect(rect, CGRectMake(10, 10, 90, 90)).should == true
689
+ rect.should == CGRectMake(10, 10, 90, 90)
690
690
  end
691
691
  end
692
692
 
@@ -695,36 +695,166 @@ describe "CGRect" do
695
695
  lower_rect = CGRectMake(0, 0, 100, 100)
696
696
  upper_rect = CGRectMake(10, 10, 100, 100)
697
697
  rect = lower_rect.union_with(upper_rect)
698
- CGRectEqualToRect(rect, CGRectMake(0, 0, 110, 110)).should == true
698
+ rect.should == CGRectMake(0, 0, 110, 110)
699
699
  end
700
700
  end
701
701
 
702
702
  describe "#grow" do
703
703
  it "should work with Numeric" do
704
704
  rect = @rect.grow(10)
705
- CGRectEqualToRect(rect, CGRectMake(0, 90, 70, 40)).should == true
705
+ rect.should == CGRectMake(0, 90, 70, 40)
706
706
  end
707
707
 
708
708
  it "should work with CGSize" do
709
709
  rect = @rect.grow(CGSizeMake(10, 20))
710
- CGRectEqualToRect(rect, CGRectMake(0, 80, 70, 60)).should == true
710
+ rect.should == CGRectMake(0, 80, 70, 60)
711
711
  end
712
712
  end
713
713
 
714
714
  describe "#shrink" do
715
715
  it "should work with Numeric" do
716
716
  rect = @rect.shrink(10)
717
- CGRectEqualToRect(rect, CGRectMake(20, 110, 30, 0)).should == true
717
+ rect.should == CGRectMake(20, 110, 30, 0)
718
718
  end
719
719
 
720
720
  it "should work with CGSize" do
721
721
  rect = @rect.shrink(CGSizeMake(20, 10))
722
- CGRectEqualToRect(rect, CGRectMake(30, 110, 10, 0)).should == true
722
+ rect.should == CGRectMake(30, 110, 10, 0)
723
723
  end
724
724
 
725
725
  it "should work with Array" do
726
726
  rect = @rect.shrink([20, 10])
727
- CGRectEqualToRect(rect, CGRectMake(30, 110, 10, 0)).should == true
727
+ rect.should == CGRectMake(30, 110, 10, 0)
728
728
  end
729
729
  end
730
+
731
+ describe "#apply" do
732
+
733
+ it "should support :left" do
734
+ rect = @rect.apply(left: 10)
735
+ rect.should == CGRectMake(0, 100, 50, 20)
736
+ end
737
+
738
+ it "should support :right" do
739
+ rect = @rect.apply(right: 10)
740
+ rect.should == CGRectMake(20, 100, 50, 20)
741
+ end
742
+
743
+ it "should support :up" do
744
+ rect = @rect.apply(up: 10)
745
+ rect.should == CGRectMake(10, 90, 50, 20)
746
+ end
747
+
748
+ it "should support :down" do
749
+ rect = @rect.apply(down: 10)
750
+ rect.should == CGRectMake(10, 110, 50, 20)
751
+ end
752
+
753
+ it "should support :wider" do
754
+ rect = @rect.apply(wider: 10)
755
+ rect.should == CGRectMake(10, 100, 60, 20)
756
+ end
757
+
758
+ it "should support :thinner" do
759
+ rect = @rect.apply(thinner: 10)
760
+ rect.should == CGRectMake(10, 100, 40, 20)
761
+ end
762
+
763
+ it "should support :taller" do
764
+ rect = @rect.apply(taller: 10)
765
+ rect.should == CGRectMake(10, 100, 50, 30)
766
+ end
767
+
768
+ it "should support :shorter" do
769
+ rect = @rect.apply(shorter: 10)
770
+ rect.should == CGRectMake(10, 100, 50, 10)
771
+ end
772
+
773
+ it "should support :x" do
774
+ rect = @rect.apply(x: 11)
775
+ rect.should == CGRectMake(11, 100, 50, 20)
776
+ end
777
+
778
+ it "should support :y" do
779
+ rect = @rect.apply(y: 10)
780
+ rect.should == CGRectMake(10, 10, 50, 20)
781
+ end
782
+
783
+ it "should support :origin" do
784
+ rect = @rect.apply(origin: [11, 10])
785
+ rect.should == CGRectMake(11, 10, 50, 20)
786
+ end
787
+
788
+ it "should support :width" do
789
+ rect = @rect.apply(width: 10)
790
+ rect.should == CGRectMake(10, 100, 10, 20)
791
+ end
792
+
793
+ it "should support :height" do
794
+ rect = @rect.apply(height: 10)
795
+ rect.should == CGRectMake(10, 100, 50, 10)
796
+ end
797
+
798
+ it "should support :size" do
799
+ rect = @rect.apply(size: [10, 10])
800
+ rect.should == CGRectMake(10, 100, 10, 10)
801
+ end
802
+
803
+ it "should support :grow" do
804
+ rect = @rect.apply(grow: 10)
805
+ rect.should == CGRectMake(0, 90, 70, 40)
806
+ end
807
+
808
+ it "should support :grow_up" do
809
+ rect = @rect.apply(grow_up: 10)
810
+ rect.should == CGRectMake(10, 90, 50, 30)
811
+ end
812
+
813
+ it "should support :shrink_down" do
814
+ rect = @rect.apply(shrink_down: 10)
815
+ rect.should == CGRectMake(10, 110, 50, 10)
816
+ end
817
+
818
+ it "should support :grow_left" do
819
+ rect = @rect.apply(grow_left: 10)
820
+ rect.should == CGRectMake(0, 100, 60, 20)
821
+ end
822
+
823
+ it "should support :shrink_right" do
824
+ rect = @rect.apply(shrink_right: 10)
825
+ rect.should == CGRectMake(20, 100, 40, 20)
826
+ end
827
+
828
+ it "should support :grow_width" do
829
+ rect = @rect.apply(grow_width: 10)
830
+ rect.should == CGRectMake(0, 100, 70, 20)
831
+ end
832
+
833
+ it "should support :grow_height" do
834
+ rect = @rect.apply(grow_height: 10)
835
+ rect.should == CGRectMake(10, 90, 50, 40)
836
+ end
837
+
838
+ it "should support :shrink" do
839
+ rect = @rect.apply(shrink: 10)
840
+ rect.should == CGRectMake(20, 110, 30, 0)
841
+ end
842
+
843
+ it "should support :shrink_width" do
844
+ rect = @rect.apply(shrink_width: 10)
845
+ rect.should == CGRectMake(20, 100, 30, 20)
846
+ end
847
+
848
+ it "should support :shrink_height" do
849
+ rect = @rect.apply(shrink_height: 10)
850
+ rect.should == CGRectMake(10, 110, 50, 0)
851
+ end
852
+
853
+ it "should support :offset" do
854
+ rect = @rect.apply(offset: [10, 10])
855
+ rect.should == CGRectMake(20, 110, 50, 20)
856
+ end
857
+
858
+ end
859
+
730
860
  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.12.3
4
+ version: 0.13.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-09 00:00:00.000000000 Z
13
+ date: 2013-10-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake