Sha256: 1513b5c539fa6882261599e10a8e9d5517792f28bff7072067f4c536f46f4d9a
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module Vedeu module Buffers # Provides a grid of Vedeu::Models::Cell objects at the given # height and width. # # @api private class Empty include Vedeu::Repositories::Defaults # @!attribute [r] name # @return [NilClass|String|Symbol] attr_reader :name # @return [Array<Array<Vedeu::Models::Cell>>] def buffer Array.new(height) do |y| unless y == 0 Array.new(width) do |x| Vedeu::Models::Cell.new(name: name, position: [y, x]) unless x == 0 end.compact end end.compact end # @note # We add 1 to both the width and height as terminal screens # are 1-indexed. # # @return [Fixnum] def height @height + 1 end # @note # We add 1 to both the width and height as terminal screens # are 1-indexed. # # @return [Fixnum] def width @width + 1 end private # Returns the default options/attributes for this class. # # @return [Hash<Symbol => Fixnum|NilClass|String|Symbol>] def defaults { height: Vedeu.height, name: nil, width: Vedeu.width, } end end # Empty end # Buffers end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.6.61 | lib/vedeu/buffers/empty.rb |