Project

demojify

0.0
The project is in a healthy, maintained state
A gem to convert all emoji in scripts to their [alt text] equivalents in ASCII-friendly characters
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 3.0

Runtime

~> 4.0
 Project Readme

demojify

A Ruby gem to convert all emoji in script files to ASCII-friendly text representations in the format [emoji_name].

Installation

Install the gem:

gem install demojify

Or add it to your Gemfile:

gem 'demojify'

Usage

Command Line

Convert emoji in all script files in the current directory and subdirectories:

demojify

Convert emoji in a specific directory:

demojify /path/to/project

Preview changes without modifying files (dry-run mode):

demojify --dry-run

Show help:

demojify --help

In Ruby Code

require 'demojify'

# Convert emoji in text
text = "Hello 😀 World 🚀"
result = Demojify::Converter.convert(text)
# => "Hello [grinning] World [rocket]"

# Process files in a directory
processor = Demojify::Processor.new(root_dir: ".", dry_run: false)
result = processor.process!
# => { total: 10, changed: 3 }

Supported File Types

The gem processes the following script file types:

  • Ruby (.rb)
  • Python (.py)
  • JavaScript (.js, .jsx)
  • TypeScript (.ts, .tsx)
  • Shell scripts (.sh, .bash, .zsh)
  • Perl (.pl)
  • PHP (.php)
  • Java (.java)
  • C/C++ (.c, .cpp, .h, .hpp)
  • Go (.go)
  • Rust (.rs)

How It Works

The gem:

  1. Recursively scans the specified directory for script files
  2. Reads each file and detects emoji characters
  3. Converts emoji to their text representation: 😀 → [grinning]
  4. Writes the modified content back to the file (unless in dry-run mode)

Development

After checking out the repo, run bundle install to install dependencies. Then, run bundle exec rspec to run the tests.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/stringsn88keys/demojify.

License

The gem is available as open source under the terms of the MIT License.