class RatatuiRuby::Layout::Size

Generic dimensions as width and height.

Layout calculations need sizes. Passing width and height as separate arguments is verbose and easy to swap by mistake.

This class bundles dimensions into a single immutable object. Extract it from a Rect or create it directly for sizing operations.

Following upstream Ratatui’s design, the same Size type represents both character-grid dimensions (columns × rows) and pixel dimensions. The semantic meaning depends on the source:

Use it for terminal dimensions, widget sizing constraints, or anywhere you need width/height without position.

Example

size = Layout::Size.new(width: 80, height: 24)
puts "Terminal is #{size.width} columns by #{size.height} rows"

# Extract from a Rect
rect = Layout::Rect.new(x: 10, y: 5, width: 80, height: 24)
size = rect.as_size # => Size(width: 80, height: 24)