mwunsch/rumoji

Loop over all emoji in string

axelson opened this issue · 1 comments

Is it possible to loop over all the emoji in the string?

Example possible api:

> Rumoji.encode_each("🐻  regular text ♥️") { |emoji| "<<#{emoji.name}>>" }
> "<<bear>>  regular text <<hearts>>"

This would allow me to customize the display of emoji, converting them into images or stripping out undesirable ones. Ideally this would also work with mutli-character emoji like 👪🏾 as a single emoji: http://emojipedia.org/family-type-5/

No, but that seems like a reasonable request. I think it would probably be using the encode_io API where if a block is given it will yield to the block otherwise it will do the replacement.

I'd be willing to accept a PR for that change.