Class: Vedeu::Buffers::Empty Private
- Inherits:
-
Object
- Object
- Vedeu::Buffers::Empty
- Includes:
- Repositories::Defaults
- Defined in:
- lib/vedeu/buffers/empty.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.
Provides a grid of Vedeu::Models::Cell objects at the given height and width.
Instance Attribute Summary collapse
- #name ⇒ NilClass|String|Symbol readonly private
Instance Method Summary collapse
- #buffer ⇒ Array<Array<Vedeu::Models::Cell>> private
-
#defaults ⇒ Hash<Symbol => Fixnum|NilClass|String|Symbol>
private
private
Returns the default options/attributes for this class.
- #height ⇒ Fixnum private
-
#initialize(attributes = {}) ⇒ void
included
from Repositories::Defaults
private
Returns a new instance of the class including this module.
- #width ⇒ Fixnum private
Instance Attribute Details
#name ⇒ NilClass|String|Symbol (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.
15 16 17 |
# File 'lib/vedeu/buffers/empty.rb', line 15 def name @name end |
Instance Method Details
#buffer ⇒ Array<Array<Vedeu::Models::Cell>>
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 21 22 23 24 |
# File 'lib/vedeu/buffers/empty.rb', line 18 def buffer Array.new(width) do |y| Array.new(height) do |x| Vedeu::Models::Cell.new(name: name, position: [y, x]) end end end |
#defaults ⇒ Hash<Symbol => Fixnum|NilClass|String|Symbol> (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 default options/attributes for this class.
49 50 51 52 53 54 55 |
# File 'lib/vedeu/buffers/empty.rb', line 49 def defaults { height: Vedeu.height, name: nil, width: Vedeu.width, } end |
#height ⇒ 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.
We add 1 to both the width and height as terminal screens are 1-indexed.
31 32 33 |
# File 'lib/vedeu/buffers/empty.rb', line 31 def height @height + 1 end |
#initialize(attributes = {}) ⇒ void Originally defined in module Repositories::Defaults
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.
If a particular key is missing from the attributes parameter, then it is added with the respective value from #defaults.
Returns a new instance of the class including this module.
#width ⇒ 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.
We add 1 to both the width and height as terminal screens are 1-indexed.
40 41 42 |
# File 'lib/vedeu/buffers/empty.rb', line 40 def width @width + 1 end |