class Reline::Face::Config
Constants
- ESSENTIAL_DEFINE_NAMES
- RESET_SGR
Attributes
definition
[R]
Public Class Methods
new
(name, &block)
# 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
[]
(name)
# File lib/reline/face.rb, line 84 def [](name) @definition.dig(name, :escape_sequence) or raise ArgumentError, "unknown face: #{name}" end
define
(name, **values)
# 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
reconfigure
()
# 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