Class: Vedeu::Grid
- Inherits:
-
Object
- Object
- Vedeu::Grid
- Defined in:
- lib/vedeu/support/grid.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
private
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #actual ⇒ Fixnum private private
- #column ⇒ Fixnum private private
-
#columns ⇒ Object
[].
- #initialize(value) ⇒ Grid constructor
- #out_of_range? ⇒ TrueClass|FalseClass private private
Constructor Details
#initialize(value) ⇒ Grid
30 31 32 |
# File 'lib/vedeu/support/grid.rb', line 30 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (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 [].
24 25 26 |
# File 'lib/vedeu/support/grid.rb', line 24 def self.columns(value) new(value).columns end |
Instance Method Details
#actual ⇒ 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.
53 54 55 |
# File 'lib/vedeu/support/grid.rb', line 53 def actual Terminal.width end |
#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.
47 48 49 |
# File 'lib/vedeu/support/grid.rb', line 47 def column actual / 12 end |
#columns ⇒ Object
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.
59 60 61 |
# File 'lib/vedeu/support/grid.rb', line 59 def out_of_range? value < 1 || value > 12 end |