Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/vedeu/geometry/grid.rb
Overview
TODO:
Don’t monkey-patch because it is naughty.
Monkey-patch Ruby’s Fixnum to provide a columns method.
Instance Method Summary collapse
-
#columns ⇒ Object
Augment Fixnum to calculate column width in a grid-based layout.
Instance Method Details
#columns ⇒ Object
Augment Fixnum to calculate column width in a grid-based layout.
The grid system splits the terminal width into 12 equal parts, by dividing the available width by 12. If the terminal width is not a multiple of 12, then Grid chooses the maximum value which will fit.
Used primarily at interface creation time:
width: 9.columns # (Terminal width / 12) * 9 characters wide; e.g.
# Terminal is 92 characters wide, maximum value is
# therefore 84, meaning a column is 7 characters wide.
16 17 18 |
# File 'lib/vedeu/geometry/grid.rb', line 16 def columns Vedeu::Grid.columns(self) end |