Sha256: e7e246ee49895c9d73ab80c78a2ce4d615f5731d2515d112d74a6b04892f153d

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module Vedeu

  # Represents an invisible escape character sequence.
  #
  # @api private
  class Escape

    # @!attribute [r] value
    # @return [String]
    attr_reader :value
    alias_method :to_s, :value
    alias_method :to_str, :value

    # Returns a new instance of Vedeu::Escape.
    #
    # @param value [String]
    # @return [Vedeu::Escape]
    def initialize(value)
      @value = value
    end

    # @return [String]
    def colour
      ''
    end

    # An object is equal when its values are the same.
    #
    # @param other [Vedeu::Char]
    # @return [Boolean]
    def eql?(other)
      self.class == other.class && value == other.value
    end
    alias_method :==, :eql?

    # Override Ruby's Object#inspect method to provide a more helpful output.
    #
    # @return [String]
    def inspect
      "<Vedeu::Escape '#{Vedeu::Esc.escape(to_s)}'>"
    end

    # @return [String]
    def position
      ''
    end

    # @return [String]
    def style
      ''
    end

  end # Escape

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.56 lib/vedeu/models/escape.rb