gui_geometry 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,7 +63,7 @@ class Rectangle < Struct.new(:loc, :size)
63
63
  alias :& :union
64
64
 
65
65
  def intersection(b)
66
- return rect unless b
66
+ return self unless b
67
67
  l = loc.max(b.loc)
68
68
  s = br.min(b.br) - l
69
69
  return rect unless s>point
@@ -1,3 +1,3 @@
1
1
  module GuiGeo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -65,6 +65,11 @@ describe "Rectangle" do
65
65
  (rect(0,0,10,10) | rect(-5,-5,10,10)).should == rect(0,0,5,5)
66
66
  end
67
67
 
68
+ it "default intersection and union" do
69
+ (rect(0,0,10,10) | nil).should == rect(0,0,10,10)
70
+ (rect(0,0,10,10) & nil).should == rect(0,0,10,10)
71
+ end
72
+
68
73
  it ".present?" do
69
74
  rect(0,0,1,1).present?.should == true
70
75
  rect(0,0,1,0).present?.should == false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gui_geometry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: