class PREP::Core::Region

Attributes

height[R]
width[R]
x[R]
y[R]

Public Class Methods

new(x, y, width, height) click to toggle source
# File lib/core/region.rb, line 17
def initialize(x, y, width, height)
  self.x = x
  self.y = y

  self.width = width
  self.height = height
end

Public Instance Methods

height=(height) click to toggle source
# File lib/core/region.rb, line 41
def height=(height)
  if height >= 0
    @height = height
  else
    raise RegionHeightOverflowError.new("Region height must be grater than zero.")
  end
end
to_s() click to toggle source
# File lib/core/region.rb, line 49
def to_s
  "[x=#{x},y=#{y},w=#{width},h=#{height}]"
end
width=(width) click to toggle source
# File lib/core/region.rb, line 33
def width=(width)
  if width >= 0
    @width = width
  else
    raise RegionWidthOverflowError.new("Region width must be grater than zero.")
  end
end
x=(x) click to toggle source
# File lib/core/region.rb, line 25
def x=(x)
  @x = x
end
y=(y) click to toggle source
# File lib/core/region.rb, line 29
def y=(y)
  @y = y
end