class Reline::Face::Config
Constants
- ESSENTIAL_DEFINE_NAMES
- RESET_SGR
Attributes
Public Class Methods
# File lib/reline/face.rb, line 62 def initialize(name, &block) @definition = {} block.call(self) ESSENTIAL_DEFINE_NAMES.each do |name| @definition[name] ||= { style: :reset, escape_sequence: RESET_SGR } end end
Public Instance Methods
# File lib/reline/face.rb, line 84 def [](name) @definition.dig(name, :escape_sequence) or raise ArgumentError, "unknown face: #{name}" end
# File lib/reline/face.rb, line 72 def define(name, **values) values[:escape_sequence] = format_to_sgr(values.to_a).freeze @definition[name] = values end
# File lib/reline/face.rb, line 77 def reconfigure @definition.each_value do |values| values.delete(:escape_sequence) values[:escape_sequence] = format_to_sgr(values.to_a).freeze end end