Sha256: 43db8edc97beeea87ba352dd33024fa71ca7d7826b359cc18a478b148fb2fb17
Contents?: true
Size: 1.28 KB
Versions: 11
Compression:
Stored size: 1.28 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| if y > 0 Array.new(width) do |x| Vedeu::Models::Cell.new(name: name, position: [y, x]) if 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
11 entries across 11 versions & 1 rubygems