Class: LesliView::Elements::Avatar

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
lib/lesli_view/elements/avatar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image: nil, name: "", size: "medium") ⇒ Avatar

Returns a new instance of Avatar.



37
38
39
40
41
42
43
44
45
46
# File 'lib/lesli_view/elements/avatar.rb', line 37

def initialize(image: nil, name: "", size: "medium")
    @image = image
    @name = name
    @size = size
    @letter = ""
    @font_size = ""
    @avatar_style = ""
    calculate_size
    get_letter unless @image
end

Instance Attribute Details

#avatar_styleObject (readonly)

Returns the value of attribute avatar_style.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def avatar_style
  @avatar_style
end

#font_sizeObject (readonly)

Returns the value of attribute font_size.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def font_size
  @font_size
end

#imageObject (readonly)

Returns the value of attribute image.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def image
  @image
end

#letterObject (readonly)

Returns the value of attribute letter.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def letter
  @letter
end

#nameObject (readonly)

Returns the value of attribute name.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



35
36
37
# File 'lib/lesli_view/elements/avatar.rb', line 35

def size
  @size
end