Class: BridgetownAvatar::Builder

Inherits:
Bridgetown::Builder
  • Object
show all
Defined in:
lib/bridgetown-avatar/builder.rb

Constant Summary collapse

DEFAULT_SIZE =
"40"
API_VERSION =
"3"
SERVERS =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



11
12
13
# File 'lib/bridgetown-avatar/builder.rb', line 11

def size
  @size
end

Instance Method Details

#buildObject



13
14
15
16
17
18
19
20
21
# File 'lib/bridgetown-avatar/builder.rb', line 13

def build
  liquid_tag "avatar" do |attributes, tag|
    @attributes = attributes # .split(",").map(&:strip)
    @size = compute_size
    @context = tag.context

    "<img src=\"#{url}\" class=\"#{classes}\"/>"
  end
end