Class: Jekyll::Avatar

Inherits:
Liquid::Tag show all
Defined in:
lib/jekyll-avatar.rb,
lib/jekyll-avatar/version.rb

Constant Summary collapse

SERVERS =
4
DEFAULT_SIZE =
40
VERSION =
'0.1.1'

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, text, tokens) ⇒ Avatar

Returns a new instance of Avatar.



9
10
11
12
# File 'lib/jekyll-avatar.rb', line 9

def initialize(tag_name, text, tokens)
  super
  @text = text
end

Instance Method Details

#render(_context) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jekyll-avatar.rb', line 14

def render(_context)
  tag = '<img '

  # See http://primercss.io/avatars/#small-avatars
  if size < 48
    tag << 'class="avatar avatar-small" '
  else
    tag << 'class="avatar" '
  end

  tag << "src=\"#{url}\" alt=\"#{username}\" "
  tag << "width=\"#{size}\" height=\"#{size}\" "
  tag << '/>'
  tag
end