Class: Vedeu::Geometries::Grid Private
- Inherits:
-
Object
- Object
- Vedeu::Geometries::Grid
- Defined in:
- lib/vedeu/geometries/dsl/grid.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The grid system splits the terminal height and width into 12 equal parts, by dividing the available height and width by 12. If the terminal height or width is not a multiple of 12, then Grid chooses the maximum value which will fit.
Class Method Summary collapse
- .columns(value) ⇒ Object private
- .rows(value) ⇒ Object private
Instance Method Summary collapse
-
#column ⇒ Fixnum
private
private
Returns the width of a single column in characters.
- #columns ⇒ Object private
-
#initialize(value) ⇒ Vedeu::Geometries::Grid
constructor
private
Returns a new instance of Vedeu::Geometries::Grid.
-
#out_of_range?(v) ⇒ Boolean
private
private
Returns a boolean indicating whether the value is out of range.
-
#row ⇒ Fixnum
private
private
Returns the height of a single row in characters.
- #rows ⇒ Object private
- #value ⇒ Fixnum private private
Constructor Details
#initialize(value) ⇒ Vedeu::Geometries::Grid
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Vedeu::Geometries::Grid.
32 33 34 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 32 def initialize(value) @value = value end |
Class Method Details
.columns(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 18 def self.columns(value) new(value).columns end |
.rows(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 24 def self.rows(value) new(value).rows end |
Instance Method Details
#column ⇒ Fixnum (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the width of a single column in characters.
51 52 53 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 51 def column Vedeu.width / 12 end |
#columns ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 37 def columns column * value end |
#out_of_range?(v) ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether the value is out of range.
59 60 61 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 59 def out_of_range?(v) v < 1 || v > 12 end |
#row ⇒ Fixnum (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the height of a single row in characters.
66 67 68 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 66 def row Vedeu.height / 12 end |
#rows ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 42 def rows row * value end |
#value ⇒ Fixnum (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 75 76 |
# File 'lib/vedeu/geometries/dsl/grid.rb', line 72 def value raise Vedeu::Error::OutOfRange if out_of_range?(@value) @value end |