Module: GuiGeo::Tools
Constant Summary
Constants included from GuiGeo
Instance Method Summary collapse
- #bound(a, bounded, c) ⇒ Object
- #clone_value(v) ⇒ Object
- #max(a, b) ⇒ Object
- #min(a, b) ⇒ Object
- #minmax(a, b) ⇒ Object
Methods included from GuiGeo
Instance Method Details
#bound(a, bounded, c) ⇒ Object
13 |
# File 'lib/gui_geometry/tools.rb', line 13 def bound(a,bounded,c) max(a,min(bounded,c)); end |
#clone_value(v) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/gui_geometry/tools.rb', line 15 def clone_value(v) case v when Fixnum, Bignum, Float then v else v.clone end end |
#max(a, b) ⇒ Object
5 |
# File 'lib/gui_geometry/tools.rb', line 5 def max(a,b) a > b ? a : b; end |
#min(a, b) ⇒ Object
4 |
# File 'lib/gui_geometry/tools.rb', line 4 def min(a,b) a < b ? a : b; end |
#minmax(a, b) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/gui_geometry/tools.rb', line 6 def minmax(a,b) if a <= b return a, b else return b, a end end |