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.



16
17
18
# File 'lib/letter_avatar/avatar.rb', line 16

def color
  @color
end

#letterObject

Returns the value of attribute letter.



16
17
18
# File 'lib/letter_avatar/avatar.rb', line 16

def letter
  @letter
end

Class Method Details

.from_username(username) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/letter_avatar/avatar.rb', line 18

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

  identity
end