Sha256: 583d13b4d167a5b70bb320f902676013988286b226717823b388dd23c7a0dd4b
Contents?: true
Size: 446 Bytes
Versions: 1
Compression:
Stored size: 446 Bytes
Contents
module UnicodeCountryFlags module CountryFlags class << self def flag_of(code) code = code.to_s.downcase return unless code.size == 2 chars = code.chars.map { |c| unicodes[c] } if chars.any?(&:nil?) nil else chars.join end end def unicodes @unicodes ||= Hash[ ('a'..'z').zip (0x1F1E6..0x1F1FF).map { |i| "&##{i};"} ] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unicode_country_flags-0.1.2 | lib/unicode_country_flags/country_flags.rb |