Class: Cogger::Formatters::Parsers::Element

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

Overview

Parses template elements for specific and dynamic colors.

Constant Summary collapse

PATTERN =
%r(
  <                  # Tag open start.
  (?<directive>\w+)  # Tag open name.
  >                  # Tag open end.
  (?<content>.+?)    # Content.
  </                 # Tag close start.
  \w+                # Tag close.
  >                  # Tag close end.
)mx

Constants inherited from Abstract

Abstract::NEW_LINE, Abstract::SANITIZERS

Instance Method Summary collapse

Constructor Details

#initialize(pattern: PATTERN) ⇒ Element

Returns a new instance of Element.



18
19
20
21
# File 'lib/cogger/formatters/parsers/element.rb', line 18

def initialize pattern: PATTERN
  super()
  @pattern = pattern
end

Instance Method Details

#call(template, level) ⇒ Object



23
24
25
26
# File 'lib/cogger/formatters/parsers/element.rb', line 23

def call template, level
  mutate template, level
  template
end