Module: Ballast::Emoji::Character
- Includes:
- ActionView::Helpers::TagHelper, ActiveSupport::Concern
- Defined in:
- lib/ballast/emoji.rb
Overview
Extensions for a emoji character.
Instance Method Summary (collapse)
-
- (String) image_tag(options = {})
(also: #html)
Returns a image tag for the current character.
-
- (String) markup
Returns a markup for the current character.
-
- (String) url
(also: #image)
Returns a image URL for the current character.
Instance Method Details
- (String) image_tag(options = {}) Also known as: html
Returns a image tag for the current character.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ballast/emoji.rb', line 97 def image_tag( = {}) = .reverse_merge({alt: markup, title: markup, rel: "tooltip"}) classes = [:class].ensure_string.tokenize(pattern: /[\s,]+/, no_duplicates: true) classes << "emoji" unless classes.include?("emoji") [:src] = url [:class] = classes.uniq.join(" ") tag(:img, ) end |
- (String) markup
Returns a markup for the current character.
82 83 84 |
# File 'lib/ballast/emoji.rb', line 82 def markup ":#{name}:" end |
- (String) url Also known as: image
Returns a image URL for the current character.
89 90 91 |
# File 'lib/ballast/emoji.rb', line 89 def url ::Emoji.url_for(image_filename) end |