Class: EY::Pairing::Author

Inherits:
Struct
  • Object
show all
Defined in:
lib/ey_pairing/author.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Author

Returns a new instance of Author.



15
16
17
18
19
# File 'lib/ey_pairing/author.rb', line 15

def initialize(*args)
  super
  self.init ||= name && name.scan(/(?:^|\s)(\w)/).flatten.join.downcase
  self.class.register self
end

Instance Attribute Details

#emailObject

Returns the value of attribute email

Returns:

  • (Object)

    the current value of email



5
6
7
# File 'lib/ey_pairing/author.rb', line 5

def email
  @email
end

#initObject

Returns the value of attribute init

Returns:

  • (Object)

    the current value of init



5
6
7
# File 'lib/ey_pairing/author.rb', line 5

def init
  @init
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/ey_pairing/author.rb', line 5

def name
  @name
end

Class Method Details

.allObject



6
7
8
# File 'lib/ey_pairing/author.rb', line 6

def self.all
  (@all || []).sort_by { |author| author.init }
end

.register(author) ⇒ Object



10
11
12
13
# File 'lib/ey_pairing/author.rb', line 10

def self.register(author)
  @all ||= []
  @all << author
end