lib/unicode/emoji.rb in unicode-emoji-0.9.0 vs lib/unicode/emoji.rb in unicode-emoji-0.9.1

- old
+ new

@@ -29,10 +29,12 @@ VALID_REGION_FLAGS = INDEX[:FLAGS].freeze VALID_SUBDIVISIONS = INDEX[:SD].freeze RECOMMENDED_SUBDIVISION_FLAGS = INDEX[:TAGS].freeze RECOMMENDED_ZWJ_SEQUENCES = INDEX[:ZWJ].freeze + LIST = INDEX[:LIST].freeze.each{ |_, sub_list| sub_list.freeze } + pack = ->(ord){ Regexp.escape(Array(ord).pack("U*")) } join = -> (*strings){ "(?:" + strings.join("|") + ")" } pack_and_join = ->(ords){ join[*ords.map{ |ord| pack[ord] }] } emoji_character = \ @@ -122,9 +124,21 @@ if props ["Emoji"] + props.map{ |prop| PROPERTY_NAMES[prop] } else # nothing + end + end + + def self.list(key = nil, sub_key = nil) + if key + if sub_key + LIST[key][sub_key] + else + LIST[key] + end + else + LIST end end def self.get_codepoint_value(char) ord = nil