Class: Vedeu::Buffers::Empty Private

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

Instance Method Summary collapse

Instance Attribute Details

#nameNilClass|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.

Returns:

  • (NilClass|String|Symbol)


15
16
17
# File 'lib/vedeu/buffers/empty.rb', line 15

def name
  @name
end

Instance Method Details

#bufferArray<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.

Returns:



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

#defaultsHash<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.

Returns:

  • (Hash<Symbol => Fixnum|NilClass|String|Symbol>)


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

#heightFixnum

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.

Note:

We add 1 to both the width and height as terminal screens are 1-indexed.

Returns:

  • (Fixnum)


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.

Note:

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.

Parameters:

  • attributes (Hash) (defaults to: {})

#widthFixnum

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.

Note:

We add 1 to both the width and height as terminal screens are 1-indexed.

Returns:

  • (Fixnum)


40
41
42
# File 'lib/vedeu/buffers/empty.rb', line 40

def width
  @width + 1
end