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"
API_VERSION =
"3"
VERSION =
"0.8.0"

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ Avatar

Returns a new instance of Avatar.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jekyll-avatar.rb', line 28

def initialize(_tag_name, text, _tokens)
  super
  @text = text.strip
  @markup = Liquid::Template.parse(@text)

  @size = compute_size
  @user_variable = extract_user_variable

  @custom_host = ENV["PAGES_AVATARS_URL"]
  @custom_host = "" unless @custom_host.is_a?(String)
end

Instance Method Details

#render(context) ⇒ Object



40
41
42
43
44
45
# File 'lib/jekyll-avatar.rb', line 40

def render(context)
  @context = context
  @text    = @markup.render(@context)
  template = lazy_load? ? LAZY_TEMPLATE : BASE_TEMPLATE
  format(template, attributes)
end