Class: LetterAvatar::Avatar::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/letter_avatar/avatar.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#colorObject

Returns the value of attribute color.



20
21
22
# File 'lib/letter_avatar/avatar.rb', line 20

def color
  @color
end

#letterObject

Returns the value of attribute letter.



20
21
22
# File 'lib/letter_avatar/avatar.rb', line 20

def letter
  @letter
end

Class Method Details

.from_username(username) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/letter_avatar/avatar.rb', line 22

def self.from_username(username)
  identity = new
  identity.color = LetterAvatar::Colors.for(username)
  identity.letter = username[0].upcase

  identity
end