struct

TermBuf::Rect

Inherits Struct < Value < Object

Stability: stable — changes only in a major release.

A rectangle of cells, in buffer coordinates with the origin at the top left. Widths and heights are never negative; a zero in either makes the rectangle empty.

Constructors

full(width : Int32, height : Int32) : Rect

The rectangle covering a whole width by height grid.

Source
new(x : Int32, y : Int32, width : Int32, height : Int32)

width cells across and height rows down, with its top left corner at (x, y). A negative width or height raises.

Source

Instance methods

bottom

Row of the bottom cell. Meaningless for an empty rectangle.

Source
contains?(x : Int32, y : Int32) : Bool

Whether (x, y) falls inside.

Source
contains?(other : Rect) : Bool

Whether other falls entirely inside. An empty rectangle is contained by anything.

Source
each_row

Yields each row index from the top edge down.

Source
empty?

Whether the rectangle covers no cells.

Source
height

Rows down.

Source
intersect(other : Rect) : Rect

The overlap of two rectangles, empty when they do not meet.

Source
right

Column of the rightmost cell. Meaningless for an empty rectangle.

Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
width

Columns across.

Source
x

Column of the left edge.

Source
y

Row of the top edge.

Source