Class: Cogger::Formatters::Parsers::Combined

Inherits:
Object
  • Object
show all
Defined in:
lib/cogger/formatters/parsers/combined.rb

Overview

Parses template literals, emojis, and keys for specific and dynamic colors.

Constant Summary collapse

STEPS =

Order matters.

[Element.new, Emoji.new, Key.new].freeze

Instance Method Summary collapse

Constructor Details

#initialize(steps: STEPS) ⇒ Combined

Returns a new instance of Combined.



10
11
12
# File 'lib/cogger/formatters/parsers/combined.rb', line 10

def initialize steps: STEPS
  @steps = steps
end

Instance Method Details

#call(template, level) ⇒ Object



14
15
16
# File 'lib/cogger/formatters/parsers/combined.rb', line 14

def call template, level
  steps.reduce(template.dup) { |modification, step| step.call modification, level }
end