Class: Vedeu::Grid

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/support/grid.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Grid

Parameters:



30
31
32
# File 'lib/vedeu/support/grid.rb', line 30

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly, private)

Returns the value of attribute value.



43
44
45
# File 'lib/vedeu/support/grid.rb', line 43

def value
  @value
end

Class Method Details

.columns(value) ⇒ Object

Returns [].

Parameters:

Returns:



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

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

Instance Method Details

#actualFixnum (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:



53
54
55
# File 'lib/vedeu/support/grid.rb', line 53

def actual
  Terminal.width
end

#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:



47
48
49
# File 'lib/vedeu/support/grid.rb', line 47

def column
  actual / 12
end

#columnsObject

Returns [].

Returns:



35
36
37
38
39
# File 'lib/vedeu/support/grid.rb', line 35

def columns
  fail OutOfRange, 'Valid range is 1..12.' if out_of_range?

  column * value
end

#out_of_range?TrueClass|FalseClass (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:

  • (TrueClass|FalseClass)


59
60
61
# File 'lib/vedeu/support/grid.rb', line 59

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