class Rect

Attributes

height[RW]
width[RW]
x[RW]
y[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/rgss3/rect.rb, line 6
def initialize(*args)
  case args.size
  when 0
    empty
  when 4
    set(*args)
  else
    raise ArgumentError
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/rgss3/rect.rb, line 40
def ==(other)
  self.class == other.class && x == other.x && y == other.y &&
    width == other.width && height == other.height
end
Also aliased as: eql?
empty() click to toggle source
# File lib/rgss3/rect.rb, line 29
def empty
  @x = 0
  @y = 0
  @width = 0
  @height = 0
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/rgss3/rect.rb, line 47
def hash
  [:rect, *to_a].hash
end
set(*args) click to toggle source
# File lib/rgss3/rect.rb, line 17
def set(*args)
  case args.size
  when 1
    rect, = args
    @x, @y, @width, @height = *rect
  when 4
    @x, @y, @width, @height = *args
  else
    raise ArgumentError
  end
end
to_a() click to toggle source
# File lib/rgss3/rect.rb, line 36
def to_a
  [x, y, width, height]
end