Sha256: 8a9d3503704334b9510ea740f8c6e1a5a842c8d5e55a4fd55bfd04fa6d6e816d

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

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 [Vedeu::Borders::Border|Vedeu::Interfaces::Interface]
      def named_parent
        if border
          border

        elsif interface
          interface

        end
      end

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

        Vedeu::EscapeSequences::Esc.border { @value }
      end

      private

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

    end # Border

  end # Cells

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.7.4 lib/vedeu/cells/border.rb
vedeu-0.7.3 lib/vedeu/cells/border.rb
vedeu-0.7.2 lib/vedeu/cells/border.rb
vedeu-0.7.1 lib/vedeu/cells/border.rb
vedeu-0.7.0 lib/vedeu/cells/border.rb