This utility converts a wordle message from slack to the utf-8 equivalent.
Place the wconv.rb file in a directory in your PATH and make it executable chmod +x
.
wconv.rb "<pasted string>"
#!/usr/bin/env ruby | |
def square(word) | |
result = { | |
black_large_square: '⬛', | |
large_yellow_square: '🟨', | |
large_green_square: '🟩', | |
white_large_square: '⬜', | |
large_blue_square: '🟦', | |
large_orange_square: '🟧' | |
}[word.to_sym] | |
(result || word).encode('utf-8') | |
end | |
input = ARGV[0] | |
lines = input.split("\n") | |
lines_with_words = lines.map do |line| | |
line.split(':').reject(&:empty?).map { |word| square(word) }.join | |
end | |
puts lines_with_words.join("\n") |