Sha256: 914e9d90af50fa003db398a5399127adfeff5082b4a53fe24683fa8f26320189
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
require 'open-uri' module EmojiRegex class Fetcher SOURCE = 'http://www.unicode.org/Public/emoji/1.0/emoji-data.txt'.freeze def initialize @emoji_code = open(SOURCE, &:read).split("\n").map { |x| x.split(" ;\t")[0] } @emoji_file_path = File.join(Dir.tmpdir, 'sorted_emoji.txt') end def save @emoji_file.tap do lines = @emoji_code.map { |line| line if line[0] != '#' }.compact.join("\n") File.write(@emoji_file_path, lines) end end alias update save def saved_path save unless File.exist?(@emoji_file_path) @emoji_file_path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emoji-regex-0.1.0 | lib/emoji-regex/fetcher.rb |