gui_geometry 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,15 @@ class Point < Struct.new(:x, :y)
7
7
  super if args.length!=0
8
8
  end
9
9
 
10
+ alias :w :x
11
+ alias :width :x
12
+ alias :col :x
13
+ alias :column :x
14
+
15
+ alias :h :y
16
+ alias :height :y
17
+ alias :line :y
18
+
10
19
  def min(b); point(Tools::min(x, b.x), Tools::min(y, b.y)); end
11
20
  def max(b); point(Tools::max(x, b.x), Tools::max(y, b.y)); end
12
21
  def bound(a, b); point(Tools::bound(a.x, x, b.x), Tools::bound(a.y, y, b.y)); end
@@ -25,5 +34,7 @@ class Point < Struct.new(:x, :y)
25
34
  def -(b) b.kind_of?(Point) ? point(x-b.x, y-b.y) : point(x-b, y-b) end
26
35
  def *(b) b.kind_of?(Point) ? point(x*b.x, y*b.y) : point(x*b, y*b) end
27
36
  def /(b) b.kind_of?(Point) ? point(x/b.x, y/b.y) : point(x/b, y/b) end
37
+
38
+ def area; x*y; end
28
39
  end
29
40
  end
@@ -44,8 +44,12 @@ class Rectangle < Struct.new(:loc, :size)
44
44
 
45
45
  def x; loc.x; end
46
46
  def y; loc.y; end
47
- def w; size.x; end
48
- def h; size.y; end
47
+ def w; size.w; end
48
+ def h; size.h; end
49
+ alias :width :w
50
+ alias :height :h
51
+
52
+ def area; size.area; end
49
53
 
50
54
  def x_range; x .. (x + w - 1) end
51
55
  def y_range; y .. (y + h - 1) end
@@ -1,3 +1,3 @@
1
1
  module GuiGeo
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
data/spec/point_spec.rb CHANGED
@@ -103,5 +103,24 @@ describe "Point" do
103
103
  point(0,4).bound(point(1,2), point(5,6)).should == point(1,4)
104
104
  point(6,4).bound(point(1,2), point(5,6)).should == point(5,4)
105
105
  end
106
+
107
+ it ".area" do
108
+ point(15, 20).area.should == 300
109
+ point(-5, 3).area.should == -15
110
+ end
111
+
112
+ it "width and height" do
113
+ point(15, 30).height.should == 30
114
+ point(15, 30).h.should == 30
115
+ point(15, 30).width.should == 15
116
+ point(15, 30).w.should == 15
117
+ end
118
+
119
+ it "line col column" do
120
+ point(15, 30).line.should == 30
121
+ point(15, 30).col.should == 15
122
+ point(15, 30).column.should == 15
123
+ end
124
+
106
125
  end
107
126
  end
@@ -136,5 +136,9 @@ describe "Rectangle" do
136
136
  r1.overlaps?(nil).should == false
137
137
  r1.contains?(nil).should == false
138
138
  end
139
+
140
+ it ".area" do
141
+ rect(5, 10, 15, 20).area.should == 300
142
+ end
139
143
  end
140
144
  end
metadata CHANGED
@@ -1,120 +1,104 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gui_geometry
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Shane Brinkman-Davis
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2013-02-24 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rspec
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
38
30
  type: :development
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rspec
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: guard-rspec
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
54
42
  type: :development
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: guard-rspec
55
46
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: guard-test
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
70
54
  type: :development
55
+ version_requirements: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ name: guard-test
71
58
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: rb-fsevent
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
59
+ requirement: &id004 !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
86
66
  type: :development
67
+ version_requirements: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ name: rb-fsevent
87
70
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: simplecov
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
71
+ requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
102
78
  type: :development
79
+ version_requirements: *id005
80
+ - !ruby/object:Gem::Dependency
81
+ name: simplecov
103
82
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- description: 2D geometry specificly designed to support graphical user interfaces
111
- and bitmaps currently focsued on Point and Rectangle classes
112
- email:
83
+ requirement: &id006 !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id006
92
+ description: 2D geometry specificly designed to support graphical user interfaces and bitmaps currently focsued on Point and Rectangle classes
93
+ email:
113
94
  - shanebdavis@gmail.com
114
95
  executables: []
96
+
115
97
  extensions: []
98
+
116
99
  extra_rdoc_files: []
117
- files:
100
+
101
+ files:
118
102
  - .gitignore
119
103
  - Gemfile
120
104
  - Guardfile
@@ -131,32 +115,37 @@ files:
131
115
  - spec/rectangle_spec.rb
132
116
  - spec/spec_helper.rb
133
117
  - spec/tools_spec.rb
118
+ has_rdoc: true
134
119
  homepage: https://github.com/shanebdavis/gui_geometry
135
120
  licenses: []
121
+
136
122
  post_install_message:
137
123
  rdoc_options: []
138
- require_paths:
124
+
125
+ require_paths:
139
126
  - lib
140
- required_ruby_version: !ruby/object:Gem::Requirement
141
- none: false
142
- requirements:
143
- - - ! '>='
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ! '>='
150
- - !ruby/object:Gem::Version
151
- version: '0'
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ segments:
139
+ - 0
140
+ version: "0"
152
141
  requirements: []
142
+
153
143
  rubyforge_project:
154
- rubygems_version: 1.8.24
144
+ rubygems_version: 1.3.6
155
145
  signing_key:
156
146
  specification_version: 3
157
- summary: 2D geometry specificly designed to support graphical user interfaces and
158
- bitmaps
159
- test_files:
147
+ summary: 2D geometry specificly designed to support graphical user interfaces and bitmaps
148
+ test_files:
160
149
  - spec/point_spec.rb
161
150
  - spec/rectangle_spec.rb
162
151
  - spec/spec_helper.rb