Class: Integrity::Author::AuthorStruct
- Defined in:
- lib/integrity/author.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #to_s ⇒ Object (also: #full)
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email
7 8 9 |
# File 'lib/integrity/author.rb', line 7 def email @email end |
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'lib/integrity/author.rb', line 7 def name @name end |
Class Method Details
.parse(string) ⇒ Object
8 9 10 11 12 |
# File 'lib/integrity/author.rb', line 8 def self.parse(string) raise ArgumentError.new("invalid author string") unless string =~ /^(.*) <(.*)>$/ new($1.strip, $2.strip) end |
Instance Method Details
#to_s ⇒ Object Also known as: full
14 15 16 |
# File 'lib/integrity/author.rb', line 14 def to_s @full ||= "#{name} <#{email}>" end |