Class: Uh::Geo

Inherits:
Struct
  • Object
show all
Defined in:
lib/uh/geo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



2
3
4
# File 'lib/uh/geo.rb', line 2

def height
  @height
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



2
3
4
# File 'lib/uh/geo.rb', line 2

def width
  @width
end

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



2
3
4
# File 'lib/uh/geo.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of 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_sObject



21
22
23
# File 'lib/uh/geo.rb', line 21

def to_s
  self.class.format_xgeometry *values
end