module Unicode::Emoji
Constants
- CANCEL_TAG
- CLDR_VERSION
- DATA_DIRECTORY
- EMOJI_CHAR
- EMOJI_COMPONENT
- EMOJI_KEYCAPS
- EMOJI_KEYCAP_SUFFIX
- EMOJI_MODIFIERS
- EMOJI_MODIFIER_BASES
- EMOJI_PRESENTATION
- EMOJI_TAG_BASE_FLAG
- EMOJI_VARIATION_SELECTOR
- EMOJI_VERSION
- EXTENDED_PICTOGRAPHIC
- EXTENDED_PICTOGRAPHIC_NO_EMOJI
- INDEX
- INDEX_FILENAME
- LIST
- LIST_REMOVED_KEYS
- PROPERTY_NAMES
- RECOMMENDED_SUBDIVISION_FLAGS
- RECOMMENDED_ZWJ_SEQUENCES
- REGEX
Matches basic singleton emoji and all kind of sequences, but restrict zwj and tag sequences to known sequences (rgi)
- REGEX_ANY
Matches any emoji-related codepoint - Use with caution (returns partil matches)
- REGEX_BASIC
Matches only basic single, non-textual emoji Ignores “components” like modifiers or simple digits
- REGEX_INCLUDE_TEXT
Combined REGEXes which also match for TEXTUAL emoji
- REGEX_PICTO
- REGEX_PICTO_NO_EMOJI
- REGEX_TEXT
Matches only basic single, textual emoji Ignores “components” like modifiers or simple digits
- REGEX_VALID
Matches basic singleton emoji and all kind of valid sequences
- REGEX_VALID_INCLUDE_TEXT
- REGEX_WELL_FORMED
Matches basic singleton emoji and all kind of sequences
- REGEX_WELL_FORMED_INCLUDE_TEXT
- REGIONAL_INDICATORS
- TAGS
- TEXT_PRESENTATION
- TEXT_VARIATION_SELECTOR
- VALID_REGION_FLAGS
- VALID_SUBDIVISIONS
- VERSION
- ZWJ
Public Class Methods
list(key = nil, sub_key = nil)
click to toggle source
# File lib/unicode/emoji.rb, line 224 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 LIST.dig(*[key, sub_key].compact) end
properties(char)
click to toggle source
# File lib/unicode/emoji.rb, line 213 def self.properties(char) ord = get_codepoint_value(char) props = INDEX[:PROPERTIES][ord] if props props.map{ |prop| PROPERTY_NAMES[prop] } else # nothing end end
Private Class Methods
get_codepoint_value(char)
click to toggle source
# File lib/unicode/emoji.rb, line 232 def self.get_codepoint_value(char) ord = nil if char.valid_encoding? ord = char.ord elsif char.encoding.name == "UTF-8" begin ord = char.unpack("U*")[0] rescue ArgumentError end end if ord ord else raise(ArgumentError, "Unicode::Emoji must be given a valid string") end end