Sha256: 0f27fc2c32e3e3de88fb8af30ede3b0292d6d5a3ddca7ac9c8e727edee9a1a64

Contents?: true

Size: 727 Bytes

Versions: 6

Compression:

Stored size: 727 Bytes

Contents

module LetterAvatar
  module AvatarHelper
    def letter_avatar_for(name, size = 64)
      LetterAvatar.generate(name, size)
    end

    def letter_avatar_url_for(avatar_path)
      LetterAvatar.path_to_url(avatar_path)
    end

    def letter_avatar_url(name, size = 64)
      letter_avatar_url_for(letter_avatar_for(name, size))
    end

    def letter_avatar_tag(name, size = 64, options = {})
      if defined?(ActionView::Helpers::AssetTagHelper)
        extend ActionView::Helpers::AssetTagHelper
        image_tag(letter_avatar_url(name, size), options.merge(alt: name))
      else
        "<img alt=\"#{name}\" class\"#{options.fetch(:class)}\" src=\"#{letter_avatar_url(name, size)}\" />"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
letter_avatar_for7-0.1.0 lib/letter_avatar/avatar_helper.rb
letter_avatar-0.3.9 lib/letter_avatar/avatar_helper.rb
letter_avatar-0.3.8 lib/letter_avatar/avatar_helper.rb
letter_avatar-0.3.7 lib/letter_avatar/avatar_helper.rb
letter_avatar-0.3.6 lib/letter_avatar/avatar_helper.rb
letter_avatar-0.3.5 lib/letter_avatar/avatar_helper.rb