kokki
A Ruby gem for converting a country name / code & IP address to an emoji flag.
Install
gem install kokki
# or
docker pull ninoseki/kokki
Usage
As a CLI
$ kokki TW
πΉπΌ
$ kokki USA
πΊπΈ
$ kokki japan
π―π΅
$ kokki 202.214.194.147
π―π΅
# it suports a defanged ip as an input
$ kokki 1.1.1[.]1
π¦πΊ
$ kokki "1.1.1(.)1"
π¦πΊ
# or
$ docker run --rm ninoseki/kokki Japan
π―π΅
As a library
require "kokki"
puts "JP: #{Kokki.flagize('JP')}"
# => JP: π―π΅
puts "JPN: #{Kokki.flagize('JPN')}"
# => JPN: π―π΅
puts "Japan: #{Kokki.flagize('Japan')}"
# => Japan: π―π΅
puts "202.214.194.147: #{Kokki.flagize('202.214.194.147')}"
# => 202.214.194.147: π―π΅
begin
Kokki.flagize("test")
rescue Kokki::InvalidInputError => e
puts e.message
# => invalid input: test
end