Class: Bunto::Avatar

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ Avatar

Returns a new instance of Avatar.



12
13
14
15
# File 'lib/bunto-avatar.rb', line 12

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

Instance Method Details

#render(context) ⇒ Object



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

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