class RatatuiRuby::Layout::Size
Terminal 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.
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)
Attributes
Height in terminal rows.
Width in terminal columns.
Public Class Methods
Source
# File lib/ratatui_ruby/layout/size.rb, line 50 def initialize(width: 0, height: 0) super(width: Integer(width), height: Integer(height)) end
Creates a new Size.
- width
-
Width in columns (Integer, coerced via +Integer()+).
- height
-
Height in rows (Integer, coerced via +Integer()+).
Calls superclass method