Class: PREP::Core::Region

Inherits:
Object
  • Object
show all
Defined in:
lib/core/region.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height) ⇒ Region

Returns a new instance of Region.



17
18
19
20
21
22
23
# 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

Instance Attribute Details

#heightObject

Returns the value of attribute height.



15
16
17
# File 'lib/core/region.rb', line 15

def height
  @height
end

#widthObject

Returns the value of attribute width.



15
16
17
# File 'lib/core/region.rb', line 15

def width
  @width
end

#xObject

Returns the value of attribute x.



15
16
17
# File 'lib/core/region.rb', line 15

def x
  @x
end

#yObject

Returns the value of attribute y.



15
16
17
# File 'lib/core/region.rb', line 15

def y
  @y
end

Instance Method Details

#to_sObject



49
50
51
# File 'lib/core/region.rb', line 49

def to_s
  "[x=#{x},y=#{y},w=#{width},h=#{height}]"
end