Class: Jekyll::Avatar
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Avatar
- Defined in:
- lib/jekyll-avatar.rb,
lib/jekyll-avatar/version.rb
Constant Summary collapse
- SERVERS =
4- DEFAULT_SIZE =
40- VERSION =
'0.2.1'
Instance Method Summary collapse
-
#initialize(_tag_name, text, _tokens) ⇒ Avatar
constructor
A new instance of Avatar.
- #render(context) ⇒ Object
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 29 |
# File 'lib/jekyll-avatar.rb', line 14 def render(context) @text = Liquid::Template.parse(@text).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 end |