Sha256: 850ca86070f9191430c41a8ecfce52d8e71a1a3443381034936afa96b6e9f3dd

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 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

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

        self
      end

      # @return [Symbol]
      def type
        :border
      end

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

        Vedeu.esc.border { @value }
      end

      private

      # @macro defaults_method
      def defaults
        super
      end

    end # Border

  end # Cells

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.8.13 lib/vedeu/cells/border.rb
vedeu-0.8.12 lib/vedeu/cells/border.rb