uzi-rect 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Uzi
2
2
  class Rect
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
data/lib/uzi-rect.rb CHANGED
@@ -102,4 +102,10 @@ module Uzi
102
102
  self.center = c
103
103
  end
104
104
  end
105
+
106
+
107
+ def contains?(loc)
108
+ x, y = *loc
109
+ x >= left && x <= right && y <= bottom && y >= top
110
+ end
105
111
  end
data/spec/rect_spec.rb CHANGED
@@ -147,4 +147,10 @@ describe Rect do
147
147
  @r.height = 11
148
148
  @r.center.should == [5.5, 5.5]
149
149
  end
150
+
151
+
152
+ it "should determine if points are inside it" do
153
+ @r.contains?([5,5]).should == true
154
+ @r.contains?([100, 100]).should == false
155
+ end
150
156
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uzi-rect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Morin