Sha256: 200ade5f34cfa9df9cfea8a14167cd0921a76b1a3ee8d5c39d6a5b1ffcf7beed

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

Stored size: 660 Bytes

Contents

module Weskit::WML::Formatters
  class AnsiColorAttribute < Attribute
    include ::Weskit::WML::Formatters::AnsiColor

    private

    def defaults
      hash = super

      hash[:assignment] = control hash[:assignment]
      hash[:code_start] = control hash[:code_start]
      hash[:code_end]   = control hash[:code_end]
      hash[:quote]      = control hash[:quote]
      hash[:underscore] = control hash[:underscore]

      hash
    end

    def escape_sequence
      reset + "#{@quote * 2}" + val_color
    end

    def text attribute
      val_color + "#{attribute.value}" + reset
    end

    def name attribute
      attribute super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
weskit-0.3.6 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.5 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.4 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.3 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.2 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.1 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.3.0 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.2.1 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.2.0 lib/weskit/wml/formatters/ansi_color_attribute.rb
weskit-0.1.0 lib/weskit/wml/formatters/ansi_color_attribute.rb