Sha256: f7bdb28ea4185ce26f6cdd71011454e41b963095589cc0911ef6ae34d64d3ec4

Contents?: true

Size: 912 Bytes

Versions: 8

Compression:

Stored size: 912 Bytes

Contents

module Vedeu

  # A Char represents a single character of the terminal. It is a container for
  # the a single character in a {Vedeu::Stream}.
  #
  # @note The parent of a Char is a Line.
  # @todo Colour and style is not being correctly reset. (GL 2014-10-19)
  #
  # @api private
  class Char

    include Presentation

    attr_reader :attributes, :parent, :value
    alias_method :data, :value

    # Returns a new instance of Char.
    #
    # @param attributes [Hash]
    # @return [Char]
    def initialize(attributes = {})
      @attributes = defaults.merge!(attributes)
      @parent     = @attributes[:parent]
      @value      = @attributes[:value]
    end

    private

    # The default values for a new instance of Char.
    #
    # @return [Hash]
    def defaults
      {
        colour: {},
        parent: nil,
        style:  [],
        value:  '',
      }
    end

  end # Char

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.2.11 lib/vedeu/models/char.rb
vedeu-0.2.10 lib/vedeu/models/char.rb
vedeu-0.2.9 lib/vedeu/models/char.rb
vedeu-0.2.8 lib/vedeu/models/char.rb
vedeu-0.2.7 lib/vedeu/models/char.rb
vedeu-0.2.6 lib/vedeu/models/char.rb
vedeu-0.2.5 lib/vedeu/models/char.rb
vedeu-0.2.4 lib/vedeu/models/char.rb