Class: Gitt::Parsers::Person
- Inherits:
-
Object
- Object
- Gitt::Parsers::Person
- Defined in:
- lib/gitt/parsers/person.rb
Overview
Parses trailer to produce a person.
Instance Method Summary collapse
- #call(content) ⇒ Object
-
#initialize(email_start: "<", email_end: ">", model: Models::Person) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(email_start: "<", email_end: ">", model: Models::Person) ⇒ Person
Returns a new instance of Person.
7 8 9 10 11 |
# File 'lib/gitt/parsers/person.rb', line 7 def initialize email_start: "<", email_end: ">", model: Models::Person @email_start = email_start @email_end = email_end @model = model end |
Instance Method Details
#call(content) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitt/parsers/person.rb', line 13 def call content if content.start_with? email_start model[email: content.delete_prefix(email_start).delete_suffix(email_end)] else name, email = content.split " #{email_start}" email.delete_suffix! email_end if email model[name:, email:] end end |