Class: Vedeu::Geometry::Grid Private
- Inherits:
-
Object
- Object
- Vedeu::Geometry::Grid
- Defined in:
- lib/vedeu/geometry/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.
Instance Attribute Summary collapse
- #value ⇒ Fixnum readonly protected private
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::Geometry::Grid
constructor
private
Returns a new instance of Vedeu::Geometry::Grid.
-
#out_of_range? ⇒ 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
Constructor Details
#initialize(value) ⇒ Vedeu::Geometry::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::Geometry::Grid.
30 31 32 |
# File 'lib/vedeu/geometry/grid.rb', line 30 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Fixnum (readonly, protected)
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.
52 53 54 |
# File 'lib/vedeu/geometry/grid.rb', line 52 def 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.
16 17 18 |
# File 'lib/vedeu/geometry/grid.rb', line 16 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.
22 23 24 |
# File 'lib/vedeu/geometry/grid.rb', line 22 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.
74 75 76 |
# File 'lib/vedeu/geometry/grid.rb', line 74 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.
35 36 37 38 39 |
# File 'lib/vedeu/geometry/grid.rb', line 35 def columns fail Vedeu::Error::OutOfRange if out_of_range? column * value end |
#out_of_range? ⇒ 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.
67 68 69 |
# File 'lib/vedeu/geometry/grid.rb', line 67 def out_of_range? value < 1 || value > 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.
59 60 61 |
# File 'lib/vedeu/geometry/grid.rb', line 59 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 45 46 |
# File 'lib/vedeu/geometry/grid.rb', line 42 def rows fail Vedeu::Error::OutOfRange if out_of_range? row * value end |