class Emoji::Character
Attributes
aliases[R]
A list of names uniquely referring to this emoji.
unicode_aliases[R]
A list of Unicode strings that uniquely refer to this emoji.
Public Class Methods
hex_inspect(str)
click to toggle source
Inspect individual Unicode characters in a string by dumping its codepoints in hexadecimal format.
# File lib/emoji/character.rb, line 5 def self.hex_inspect(str) str.codepoints.map { |c| c.to_s(16).rjust(4, '0') }.join('-') end
new(name)
click to toggle source
# File lib/emoji/character.rb, line 39 def initialize(name) @aliases = Array(name) @unicode_aliases = [] @tags = [] end
Public Instance Methods
add_alias(name)
click to toggle source
# File lib/emoji/character.rb, line 17 def add_alias(name) aliases << name end
add_tag(tag)
click to toggle source
# File lib/emoji/character.rb, line 35 def add_tag(tag) tags << tag end
add_unicode_alias(str)
click to toggle source
# File lib/emoji/character.rb, line 27 def add_unicode_alias(str) unicode_aliases << str end
custom?()
click to toggle source
True if the emoji is not a standard Emoji character.
# File lib/emoji/character.rb, line 10 def custom?() !raw end
hex_inspect()
click to toggle source
# File lib/emoji/character.rb, line 50 def hex_inspect self.class.hex_inspect(raw) end
image_filename()
click to toggle source
# File lib/emoji/character.rb, line 54 def image_filename if custom? '%s.png' % name else 'unicode/%s.png' % hex_inspect.sub(/-fe0f\b/, '') end end
inspect()
click to toggle source
# File lib/emoji/character.rb, line 45 def inspect hex = '(%s)' % hex_inspect unless custom? %Q(#<#{self.class.name}:#{name}#{hex}>) end
name()
click to toggle source
# File lib/emoji/character.rb, line 15 def name() aliases.first end
raw()
click to toggle source
Raw Unicode string for an emoji. Nil if emoji is non-standard.
# File lib/emoji/character.rb, line 25 def raw() unicode_aliases.first end