Module: Dimensions
- Included in:
- Rectangle
- Defined in:
- tomes/spells/geometry/dimensions.rb
Overview
A method for handling some basic properties of a rectangle.
Instance Attribute Summary
Attributes included from Size
Attributes included from Location
Instance Method Summary collapse
-
#change_dimensions(location, size) ⇒ Void
(also: #set_dimensions)
Sets the location and size of a rectangle.
-
#dimensions ⇒ Hash
Returns a has with the X and Y coordinates of a rectangle, along with its width and height.
-
#rect ⇒ Hash
Returns the #dimensions of a rectangle, along with a default border ‘primitive_marker` to help DragonRuby render it.
Methods included from Center
#horizontal_center, #true_center, #vertical_center
Methods included from Apex
Methods included from Size
Methods included from Location
#adjust_location, #location, #location=
Instance Method Details
#change_dimensions(location, size) ⇒ Void Also known as: set_dimensions
Sets the location and size of a rectangle.
36 37 38 39 |
# File 'tomes/spells/geometry/dimensions.rb', line 36 def change_dimensions(location, size) set_location location set_size size end |
#dimensions ⇒ Hash
Returns a has with the X and Y coordinates of a rectangle, along with its width and height.
23 24 25 26 27 28 29 30 |
# File 'tomes/spells/geometry/dimensions.rb', line 23 def dimensions { x: x, y: y, w: width, h: height } end |
#rect ⇒ Hash
Returns the #dimensions of a rectangle, along with a default border ‘primitive_marker` to help DragonRuby render it.
17 18 19 |
# File 'tomes/spells/geometry/dimensions.rb', line 17 def rect dimensions.merge({ primitive_marker: :border }) end |