Class: Gitt::Models::Person

Inherits:
Data
  • Object
show all
Defined in:
lib/gitt/models/person.rb

Overview

Represents a person within a repository.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, delimiter: " ", email: nil) ⇒ Person

Returns a new instance of Person.



11
12
13
# File 'lib/gitt/models/person.rb', line 11

def initialize name: nil, delimiter: " ", email: nil
  super
end

Instance Attribute Details

#delimiterObject (readonly)

Returns the value of attribute delimiter

Returns:

  • (Object)

    the current value of delimiter



8
9
10
# File 'lib/gitt/models/person.rb', line 8

def delimiter
  @delimiter
end

#emailObject (readonly)

Returns the value of attribute email

Returns:

  • (Object)

    the current value of email



8
9
10
# File 'lib/gitt/models/person.rb', line 8

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/gitt/models/person.rb', line 8

def name
  @name
end

Class Method Details

.for(string, parser: Parsers::Person.new) ⇒ Object



9
# File 'lib/gitt/models/person.rb', line 9

def self.for(string, parser: Parsers::Person.new) = parser.call string

Instance Method Details

#to_sObject



15
16
17
18
19
20
21
22
# File 'lib/gitt/models/person.rb', line 15

def to_s
  case self
    in String, String, String then "#{name}#{delimiter}<#{email}>"
    in String, String, nil then name
    in nil, String, String then "<#{email}>"
    else Core::EMPTY_STRING
  end
end