gui_geometry 0.0.5 → 0.0.6
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.
- data/README.md +19 -1
- data/lib/gui_geometry.rb +5 -0
- data/lib/gui_geometry/tools.rb +1 -3
- data/lib/gui_geometry/version.rb +1 -1
- data/spec/point_spec.rb +1 -1
- data/spec/rectangle_spec.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Rectangles consist of two point objects. One specifies the location of the recta
|
|
24
24
|
|
25
25
|
``` ruby
|
26
26
|
require "gui_geometry"
|
27
|
-
include GuiGeometry
|
27
|
+
include GuiGeometry
|
28
28
|
|
29
29
|
# create point x == y == 0
|
30
30
|
point
|
@@ -63,6 +63,24 @@ rect point(30,50)
|
|
63
63
|
|
64
64
|
```
|
65
65
|
|
66
|
+
To get access to min, max, bound, and minmax:
|
67
|
+
|
68
|
+
```
|
69
|
+
include GuiGeometry::Tools
|
70
|
+
|
71
|
+
min(4,5)
|
72
|
+
# => 4
|
73
|
+
|
74
|
+
max(4,5)
|
75
|
+
# => 5
|
76
|
+
|
77
|
+
minmax(4,5)
|
78
|
+
# => [4,5]
|
79
|
+
|
80
|
+
bound(5,4,10)
|
81
|
+
# => 5
|
82
|
+
```
|
83
|
+
|
66
84
|
## Contributing
|
67
85
|
|
68
86
|
1. Fork it
|
data/lib/gui_geometry.rb
CHANGED
data/lib/gui_geometry/tools.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module GuiGeometry
|
2
2
|
module Tools
|
3
|
+
include ::GuiGeometry
|
3
4
|
def min(a,b) a < b ? a : b; end
|
4
5
|
def max(a,b) a > b ? a : b; end
|
5
6
|
def minmax(a,b)
|
@@ -10,8 +11,5 @@ module Tools
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
def bound(a,bounded,c) max(a,min(bounded,c)); end
|
13
|
-
|
14
|
-
def point(*args); GuiGeometry::Point.new *args end
|
15
|
-
def rect(*args); GuiGeometry::Rectangle.new *args end
|
16
14
|
end
|
17
15
|
end
|
data/lib/gui_geometry/version.rb
CHANGED
data/spec/point_spec.rb
CHANGED
data/spec/rectangle_spec.rb
CHANGED