Class: Jekyll::Avatar

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

Constant Summary collapse

SERVERS =
4
DEFAULT_SIZE =
40
API_VERSION =
3
VERSION =
"0.7.0".freeze

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ Avatar

Returns a new instance of Avatar.



13
14
15
16
# File 'lib/jekyll-avatar.rb', line 13

def initialize(_tag_name, text, _tokens)
  super
  @text = text
end

Instance Method Details

#render(context) ⇒ Object



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

def render(context)
  @context = context
  @text    = Liquid::Template.parse(@text).render(@context)
  attrs    = attributes.map { |k, v| "#{k}=\"#{v}\"" }.join(" ")
  "<img #{attrs} />"
end