Class: Charming::Screen
- Inherits:
-
Data
- Object
- Data
- Charming::Screen
- Defined in:
- lib/charming/screen.rb
Overview
Screen represents the terminal viewport dimensions as a simple Data class. The ‘width` and `height` values flow from the backend through the runtime loop into every controller dispatch for layout calculations.
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height
7 8 9 |
# File 'lib/charming/screen.rb', line 7 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width
7 8 9 |
# File 'lib/charming/screen.rb', line 7 def width @width end |
Instance Method Details
#narrow?(below:, min_height: nil) ⇒ Boolean
8 9 10 |
# File 'lib/charming/screen.rb', line 8 def narrow?(below:, min_height: nil) width < below && (min_height.nil? || height >= min_height) end |