lib/unicode/emoji.rb in unicode-emoji-3.7.0 vs lib/unicode/emoji.rb in unicode-emoji-3.8.0

- old
+ new

@@ -7,35 +7,61 @@ module Unicode module Emoji autoload :INDEX, File.expand_path('emoji/index', __dir__) %w[ - EMOJI_CHAR EMOJI_CHAR EMOJI_PRESENTATION TEXT_PRESENTATION EMOJI_COMPONENT EMOJI_MODIFIER_BASES - EMOJI_MODIFIERS EXTENDED_PICTOGRAPHIC EXTENDED_PICTOGRAPHIC_NO_EMOJI EMOJI_KEYCAPS VALID_REGION_FLAGS - VALID_SUBDIVISIONS RECOMMENDED_SUBDIVISION_FLAGS RECOMMENDED_ZWJ_SEQUENCES + EMOJI_CHAR + EMOJI_PRESENTATION + TEXT_PRESENTATION + EMOJI_COMPONENT + EMOJI_MODIFIER_BASES + EMOJI_MODIFIERS + EXTENDED_PICTOGRAPHIC + EXTENDED_PICTOGRAPHIC_NO_EMOJI + EMOJI_KEYCAPS VALID_REGION_FLAGS + VALID_SUBDIVISIONS + RECOMMENDED_SUBDIVISION_FLAGS + RECOMMENDED_ZWJ_SEQUENCES ].each do |const_name| autoload const_name, File.expand_path('emoji/lazy_constants', __dir__) end %w[ - LIST LIST_REMOVED_KEYS + LIST + LIST_REMOVED_KEYS ].each do |const_name| autoload const_name, File.expand_path('emoji/list', __dir__) end generated_constants_dirpath = File.expand_path( EMOJI_VERSION == Unicode::Version.emoji_version ? "emoji/generated_native/" : "emoji/generated/", __dir__ ) %w[ - REGEX REGEX_VALID REGEX_WELL_FORMED REGEX_POSSIBLE REGEX_BASIC REGEX_TEXT REGEX_ANY REGEX_INCLUDE_TEXT - REGEX_VALID_INCLUDE_TEXT REGEX_WELL_FORMED_INCLUDE_TEXT REGEX_PICTO REGEX_PICTO_NO_EMOJI + REGEX + REGEX_INCLUDE_TEXT + REGEX_INCLUDE_MQE + REGEX_INCLUDE_MQE_UQE + REGEX_VALID + REGEX_VALID_INCLUDE_TEXT + REGEX_WELL_FORMED + REGEX_WELL_FORMED_INCLUDE_TEXT + REGEX_POSSIBLE + REGEX_BASIC + REGEX_TEXT + REGEX_PICTO + REGEX_PICTO_NO_EMOJI + REGEX_ANY ].each do |const_name| autoload const_name, File.join(generated_constants_dirpath, const_name.downcase) end + # Return Emoji properties of character as an Array or nil + # See PROPERTY_NAMES constant for possible properties + # + # Source: see https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-data.txt def self.properties(char) ord = get_codepoint_value(char) props = INDEX[:PROPERTIES][ord] if props @@ -43,9 +69,10 @@ else # nothing end end + # Returns ordered list of Emoji, categorized in a three-level deep Hash structure def self.list(key = nil, sub_key = nil) return LIST unless key || sub_key if LIST_REMOVED_KEYS.include?(key) $stderr.puts "Warning(unicode-emoji): The category of #{key} does not exist anymore" end