Class: Cogger::Formatters::Processors::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/cogger/formatters/processors/color.rb

Overview

Processes emojis and colors.

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::Dynamic.new, kit: {sanitizer: Kit::Sanitizer, colorizer: Kit::Colorizer}, registry: Cogger) ⇒ Color

Returns a new instance of Color.



10
11
12
13
14
15
16
# File 'lib/cogger/formatters/processors/color.rb', line 10

def initialize parser: Parsers::Dynamic.new,
               kit: {sanitizer: Kit::Sanitizer, colorizer: Kit::Colorizer},
               registry: Cogger
  @parser = parser
  @kit = kit
  @registry = registry
end

Instance Method Details

#call(template, *input) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/cogger/formatters/processors/color.rb', line 18

def call(template, *input)
  attributes = sanitizer.call(*input).tagged

  case parser.call template
    in [String => body, String => style] then universal body, style, **attributes
    in [String => body, Hash => styles] then individual body, attributes, styles
    # :nocov:
  end
end