Class: Gitt::Parsers::Tag
- Inherits:
-
Object
- Object
- Gitt::Parsers::Tag
- Defined in:
- lib/gitt/parsers/tag.rb
Overview
Parses raw tag information to produce a tag record.
Instance Method Summary collapse
-
#call(content) ⇒ Object
:reek:TooManyStatements.
-
#initialize(attributer: Attributer.new(Commands::Tag::KEY_MAP.keys), sanitizers: Sanitizers::CONTAINER, model: Models::Tag) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(attributer: Attributer.new(Commands::Tag::KEY_MAP.keys), sanitizers: Sanitizers::CONTAINER, model: Models::Tag) ⇒ Tag
Returns a new instance of Tag.
11 12 13 14 15 16 17 |
# File 'lib/gitt/parsers/tag.rb', line 11 def initialize attributer: Attributer.new(Commands::Tag::KEY_MAP.keys), sanitizers: Sanitizers::CONTAINER, model: Models::Tag @attributer = attributer @sanitizers = sanitizers @model = model end |
Instance Method Details
#call(content) ⇒ Object
:reek:TooManyStatements
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitt/parsers/tag.rb', line 20 def call content attributes = attributer.call content body, trailers = attributes.values_at :body, :trailers sanitize attributes attributes[:body] = ( trailers ? body.sub(/\n??#{Regexp.escape trailers}\n??/, "") : body ).to_s.chomp model[**attributes] end |