Sha256: 448daa2a97f76ab5067ee4e5bc96bc6f043a69c9a71d2561eaa343db3ea83583

Contents?: true

Size: 342 Bytes

Versions: 186

Compression:

Stored size: 342 Bytes

Contents

require "unicode/emoji"

module BulletTrain
  module CoreExt
    module StringEmojiHelper
      def strip_emojis
        gsub(Unicode::Emoji::REGEX, "")
      end

      def only_emoji?
        return false if strip.empty?
        strip_emojis.strip.empty?
      end
    end
  end
end

String.include(BulletTrain::CoreExt::StringEmojiHelper)

Version data entries

186 entries across 186 versions & 1 rubygems

Version Path
bullet_train-1.0.57 lib/bullet_train/core_ext/string_emoji_helper.rb
bullet_train-1.0.56 lib/bullet_train/core_ext/string_emoji_helper.rb
bullet_train-1.0.53 lib/bullet_train/core_ext/string_emoji_helper.rb
bullet_train-1.0.52 lib/bullet_train/core_ext/string_emoji_helper.rb
bullet_train-1.0.51 lib/bullet_train/core_ext/string_emoji_helper.rb
bullet_train-1.0.50 lib/bullet_train/core_ext/string_emoji_helper.rb