Class: Hobostove::Emoji
- Inherits:
-
Object
- Object
- Hobostove::Emoji
- Defined in:
- lib/hobostove/emoji.rb
Class Method Summary collapse
Class Method Details
.replace(string) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/hobostove/emoji.rb', line 5 def self.replace(string) csv = File.("../../../data/emoji.csv", __FILE__) CSV.foreach(csv) do |row| if string =~ /:#{row[0]}:/ character = [row[1].hex].pack("U") string.gsub!(":#{row[0]}:", character) end end string end |