Module: BulletTrain::CoreExt::StringEmojiHelper
- Defined in:
- lib/bullet_train/core_ext/string_emoji_helper.rb
Instance Method Summary collapse
Instance Method Details
#only_emoji? ⇒ Boolean
11 12 13 14 |
# File 'lib/bullet_train/core_ext/string_emoji_helper.rb', line 11 def only_emoji? return false if strip.empty? strip_emojis.strip.empty? end |
#strip_emojis ⇒ Object
4 5 6 7 8 9 |
# File 'lib/bullet_train/core_ext/string_emoji_helper.rb', line 4 def strip_emojis unless Object.const_defined?("Unicode::Emoji") raise "Unicode::Emoji is not defined. If you want to use the strip_emoji and/or only_emoji? methods you need to add the `unicode-emoji` gem to your `Gemfile`." end gsub(Unicode::Emoji::REGEX, "") end |