lib/tanuki_emoji/character.rb in tanuki_emoji-0.5.0 vs lib/tanuki_emoji/character.rb in tanuki_emoji-0.6.0
- old
+ new
@@ -14,15 +14,16 @@
# This denotes a "color" or "emoji" version
EMOJI_VARIATION_SELECTOR = 0xFE0F
# This denotes a "plain" (black/white) or "textual" version
PLAIN_VARIATION_SELECTOR = 0xFE0E
+ PLAIN_VARIATION_SELECTOR_STRING = PLAIN_VARIATION_SELECTOR.chr(Encoding::UTF_8)
# Zero Width Joiner is used in sequences to indicate they should all be evaluated and displayed as a single thing
ZWJ_TAG = 0x200D
- attr_reader :name, :codepoints, :codepoints_alternates, :alpha_code, :aliases, :description, :category
+ attr_reader :name, :codepoints, :codepoints_alternates, :alpha_code, :aliases, :ascii_aliases, :description, :category
attr_accessor :unicode_version
# @param [String] name
# @param [String] codepoints
@@ -33,10 +34,11 @@
@name = self.class.format_name(name)
@codepoints = codepoints
@codepoints_alternates = []
@alpha_code = self.class.format_alpha_code(alpha_code)
@aliases = []
+ @ascii_aliases = []
@description = description
@category = category
end
# Add alternative codepoints to this character
@@ -51,10 +53,17 @@
# @param [String] alpha_code
def add_alias(alpha_code)
aliases << self.class.format_alpha_code(alpha_code)
end
+ # Add alternative ASCII aliases to this character
+ #
+ # @param [String] ascii_string
+ def add_ascii_alias(ascii_string)
+ ascii_aliases << ascii_string
+ end
+
# Return a Hex formatted version of the Unicode code points
#
# @return [String] Hex formatted version of the unicode
def hex
unicode_to_hex(codepoints).join('-')
@@ -92,9 +101,10 @@
name == other.name &&
codepoints == other.codepoints &&
codepoints_alternates == other.codepoints_alternates &&
alpha_code == other.alpha_code &&
aliases == other.aliases &&
+ ascii_aliases == other.ascii_aliases &&
description == other.description
end
# Ensure alpha code is formatted with colons
#