Sha256: 188654eb0abb40a75097f362687a04d674c754b519beed66cdcfe8ba255168cb

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Vedeu

  module Cells

    # Provides the character/escape sequence to draw one cell of a
    # border with a custom value, colour and style.
    #
    # @api private
    #
    class Border < Vedeu::Cells::Empty

      extend Forwardable
      include Vedeu::Presentation

      def_delegators :geometry,
                     :x,
                     :xn,
                     :y,
                     :yn

      # @return [Hash<Symbol => void>]
      def attributes
        {
          colour: colour,
          name:   @name,
          style:  style,
        }
      end

      # @return [Boolean]
      def cell?
        false
      end

      # @param value [String|Symbol]
      # @return [Vedeu::Cells::Border]
      def name=(value)
        @name = value

        self
      end

      # @return [String]
      def value
        return '' unless present?(@value)

        Vedeu.esc.border { @value }
      end

      private

      # @return [Hash<Symbol => Hash<void>>]
      def defaults
        super
      end

    end # Border

  end # Cells

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.8.2 lib/vedeu/cells/border.rb