lib/unicode/emoji.rb in unicode-emoji-1.0.3 vs lib/unicode/emoji.rb in unicode-emoji-1.1.0

- old
+ new

@@ -4,29 +4,33 @@ require_relative "emoji/index" module Unicode module Emoji PROPERTY_NAMES = { + E: "Emoji", B: "Emoji_Modifier_Base", M: "Emoji_Modifier", C: "Emoji_Component", P: "Emoji_Presentation", + X: "Extended_Pictographic", } EMOJI_VARIATION_SELECTOR = 0xFE0F TEXT_VARIATION_SELECTOR = 0xFE0E EMOJI_TAG_BASE_FLAG = 0x1F3F4 CANCEL_TAG = 0xE007F EMOJI_KEYCAP_SUFFIX = 0x20E3 ZWJ = 0x200D - EMOJI_CHAR = INDEX[:PROPERTIES].keys.freeze + EMOJI_CHAR = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:E) }.keys.freeze EMOJI_PRESENTATION = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:P) }.keys.freeze - TEXT_PRESENTATION = INDEX[:PROPERTIES].select{ |ord, props| !props.include?(:P) }.keys.freeze + TEXT_PRESENTATION = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:E) && !props.include?(:P) }.keys.freeze EMOJI_COMPONENT = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:C) }.keys.freeze EMOJI_MODIFIER_BASES = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:B) }.keys.freeze EMOJI_MODIFIERS = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:M) }.keys.freeze + # Not needed right now: + # EXTENDED_PICTOGRAPHIC = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) }.keys.freeze EMOJI_KEYCAPS = INDEX[:KEYCAPS].freeze VALID_REGION_FLAGS = INDEX[:FLAGS].freeze VALID_SUBDIVISIONS = INDEX[:SD].freeze RECOMMENDED_SUBDIVISION_FLAGS = INDEX[:TAGS].freeze RECOMMENDED_ZWJ_SEQUENCES = INDEX[:ZWJ].freeze @@ -129,10 +133,10 @@ def self.properties(char) ord = get_codepoint_value(char) props = INDEX[:PROPERTIES][ord] if props - ["Emoji"] + props.map{ |prop| PROPERTY_NAMES[prop] } + props.map{ |prop| PROPERTY_NAMES[prop] } else # nothing end end