Class: Uh::Geo
- Inherits:
-
Struct
- Object
- Struct
- Uh::Geo
- Defined in:
- lib/uh/geo.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Geo
constructor
A new instance of Geo.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Geo
Returns a new instance of Geo.
14 15 16 17 18 19 |
# File 'lib/uh/geo.rb', line 14 def initialize(*args) super %i[width height].each do |dimension| check_value dimension, send(dimension) end end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height
2 3 4 |
# File 'lib/uh/geo.rb', line 2 def height @height end |
#width ⇒ Object
Returns the value of attribute width
2 3 4 |
# File 'lib/uh/geo.rb', line 2 def width @width end |
#x ⇒ Object
Returns the value of attribute x
2 3 4 |
# File 'lib/uh/geo.rb', line 2 def x @x end |
#y ⇒ Object
Returns the value of attribute y
2 3 4 |
# File 'lib/uh/geo.rb', line 2 def y @y end |
Class Method Details
.format_xgeometry(x, y, width, height) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/uh/geo.rb', line 4 def format_xgeometry(x, y, width, height) '%sx%s+%s+%s' % [ width ? width.to_s : ??, height ? height.to_s : ??, x ? x.to_s : ??, y ? y.to_s : ?? ] end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/uh/geo.rb', line 21 def to_s self.class.format_xgeometry *values end |