Class: Gitt::Sanitizers::Trailers

Inherits:
Object
  • Object
show all
Defined in:
lib/gitt/sanitizers/trailers.rb

Overview

Sanitizes content by turning it into an array of trailer records.

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::Trailer.new) ⇒ Trailers

Returns a new instance of Trailers.



7
8
9
# File 'lib/gitt/sanitizers/trailers.rb', line 7

def initialize parser: Parsers::Trailer.new
  @parser = parser
end

Instance Method Details

#call(text) ⇒ Object



11
12
13
14
15
# File 'lib/gitt/sanitizers/trailers.rb', line 11

def call text
  String(text).split("\n")
              .map { |line| parser.call line }
              .reject(&:empty?)
end