Class: DiscourseEmojis::CodepointsEmojiProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/discourse_emojis/codepoints_emoji_processor.rb

Constant Summary collapse

EMOJI_TO_NAME_PATH =

The CodepointsEmojiProcessor class is responsible for processing emoji images based on their Unicode codepoints. It extracts emoji assets, maps them to their respective names, and organizes them into the appropriate output directory structure.

Constants:

  • EMOJI_TO_NAME_PATH: Path to the JSON file mapping emoji to names.

  • TONABLE_EMOJIS_PATH: Path to the JSON file listing tonable emojis.

Usage: To process emoji images, call the ‘process` method with the necessary parameters:

CodepointsEmojiProcessor.process(name, url, asset_subdir, output_dir)

Parameters:

  • name: The name of the emoji set being processed.

  • url: The URL of the ZIP file containing the emoji assets.

  • asset_subdir: The subdirectory within the extracted files where emoji images are located.

  • output_dir: The directory where processed emoji images should be saved.

Example: CodepointsEmojiProcessor.process(“twemoji”, “example.com/twemoji.zip”, “assets”, “./output”)

"./dist/emoji_to_name.json"
TONABLE_EMOJIS_PATH =
"./dist/tonable_emojis.json"

Class Method Summary collapse

Class Method Details

.process(name, url, asset_subdir) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/discourse_emojis/codepoints_emoji_processor.rb', line 36

def process(name, url, asset_subdir)
  output_dir = File.join(DiscourseEmojis.path_for_emojis, name)

  ZipProcessor.with_extracted_files(url) do |extract_path|
    asset_path = File.join(extract_path, asset_subdir)
    process_images(asset_path, output_dir)
  end
end