Class: Vedeu::Geometries::Grid Private

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.

Parameters:

  • value (Fixnum)


32
33
34
# File 'lib/vedeu/geometries/dsl/grid.rb', line 32

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueFixnum (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.

Returns:

  • (Fixnum)


54
55
56
# File 'lib/vedeu/geometries/dsl/grid.rb', line 54

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.

See Also:



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.

See Also:



24
25
26
# File 'lib/vedeu/geometries/dsl/grid.rb', line 24

def self.rows(value)
  new(value).rows
end

Instance Method Details

#columnFixnum (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.

Returns:

  • (Fixnum)


76
77
78
# File 'lib/vedeu/geometries/dsl/grid.rb', line 76

def column
  Vedeu.width / 12
end

#columnsObject

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.

See Also:



37
38
39
40
41
# File 'lib/vedeu/geometries/dsl/grid.rb', line 37

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.

Returns:



69
70
71
# File 'lib/vedeu/geometries/dsl/grid.rb', line 69

def out_of_range?
  value < 1 || value > 12
end

#rowFixnum (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.

Returns:

  • (Fixnum)


61
62
63
# File 'lib/vedeu/geometries/dsl/grid.rb', line 61

def row
  Vedeu.height / 12
end

#rowsObject

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.

See Also:



44
45
46
47
48
# File 'lib/vedeu/geometries/dsl/grid.rb', line 44

def rows
  fail Vedeu::Error::OutOfRange if out_of_range?

  row * value
end