Class: ByebugColorPrinter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/byebug-color-printer/base.rb

Constant Summary collapse

@@colorizers =
{}

Class Method Summary collapse

Class Method Details

.apply_colorizer(path, args, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/byebug-color-printer/base.rb', line 15

def self.apply_colorizer(path, args, &block)
  colorizer = @@colorizers[path]

  return yield args unless colorizer

  colorizer.colorize(args, &block)
end

.fetch_colorizer(path) ⇒ Object



11
12
13
# File 'lib/byebug-color-printer/base.rb', line 11

def self.fetch_colorizer(path)
  @@colorizers[path]
end

.register_colorizer(path, colorizer) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
# File 'lib/byebug-color-printer/base.rb', line 5

def self.register_colorizer(path, colorizer)
  raise ArgumentError.new('colorizer must be an instance of a Colorizer child') unless colorizer.is_a?(Colorizer)

  @@colorizers[path] = colorizer
end