Class: Vedeu::Models::Row Private
- Inherits:
-
Object
- Object
- Vedeu::Models::Row
- Extended by:
- Forwardable
- Includes:
- Enumerable, Common
- Defined in:
- lib/vedeu/models/row.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.
A Row represents an array of Vedeu::Cells::Empty objects.
Instance Attribute Summary collapse
- #cells ⇒ Array<NilClass|void> readonly private
Instance Method Summary collapse
- #cell(index) ⇒ NilClass|void private
- #content ⇒ Array<void> private
-
#each(&block) ⇒ Enumerator
private
Provides iteration over the collection.
- #empty? ⇒ Boolean private
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#initialize(cells = []) ⇒ Vedeu::Models::Row
constructor
private
Returns a new instance of Vedeu::Models::Row.
-
#reset_character ⇒ Vedeu::Cells::Escape
private
Provides the reset escape sequence at the end of a row to reset colour and style information to prevent colour bleed on the next line.
- #size ⇒ Fixnum private
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(cells = []) ⇒ Vedeu::Models::Row
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::Models::Row.
33 34 35 |
# File 'lib/vedeu/models/row.rb', line 33 def initialize(cells = []) @cells = cells || [] end |
Instance Attribute Details
#cells ⇒ Array<NilClass|void> (readonly)
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/models/row.rb', line 18 def cells @cells end |
Instance Method Details
#cell(index) ⇒ NilClass|void
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.
39 40 41 42 43 |
# File 'lib/vedeu/models/row.rb', line 39 def cell(index) return nil if index.nil? || empty? cells[index] end |
#content ⇒ Array<void>
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.
46 47 48 |
# File 'lib/vedeu/models/row.rb', line 46 def content (cells.flatten << reset_character) end |
#each(&block) ⇒ Enumerator
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.
Provides iteration over the collection.
54 55 56 |
# File 'lib/vedeu/models/row.rb', line 54 def each(&block) cells.each(&block) end |
#empty? ⇒ Boolean
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/models/row.rb', line 59 def empty? cells.empty? end |
#eql?(other) ⇒ Boolean Also known as: ==
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.
An object is equal when its values are the same.
67 68 69 |
# File 'lib/vedeu/models/row.rb', line 67 def eql?(other) self.class.equal?(other.class) && cells == other.cells end |
#reset_character ⇒ Vedeu::Cells::Escape
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.
Provides the reset escape sequence at the end of a row to reset colour and style information to prevent colour bleed on the next line.
77 78 79 |
# File 'lib/vedeu/models/row.rb', line 77 def reset_character Vedeu::Cells::Escape.new(value: Vedeu.esc.reset) end |
#size ⇒ Fixnum
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.
82 83 84 |
# File 'lib/vedeu/models/row.rb', line 82 def size cells.size end |