Module: ISO3166::Emoji

Included in:
Country
Defined in:
lib/countries/country/emoji.rb

Constant Summary collapse

CODE_POINTS =
{
  'a' => '🇦',
  'b' => '🇧',
  'c' => '🇨',
  'd' => '🇩',
  'e' => '🇪',
  'f' => '🇫',
  'g' => '🇬',
  'h' => '🇭',
  'i' => '🇮',
  'j' => '🇯',
  'k' => '🇰',
  'l' => '🇱',
  'm' => '🇲',
  'n' => '🇳',
  'o' => '🇴',
  'p' => '🇵',
  'q' => '🇶',
  'r' => '🇷',
  's' => '🇸',
  't' => '🇹',
  'u' => '🇺',
  'v' => '🇻',
  'w' => '🇼',
  'x' => '🇽',
  'y' => '🇾',
  'z' => '🇿'
}.freeze

Instance Method Summary collapse

Instance Method Details

#emoji_flagString

The emoji flag for this country, using Unicode Regional Indicator characters. e.g: “U+1F1FA U+1F1F8” for 🇺🇸

Returns:

  • (String)

    the emoji flag for this country



37
38
39
# File 'lib/countries/country/emoji.rb', line 37

def emoji_flag
  alpha2.downcase.chars.map { |c| CODE_POINTS[c] }.join.freeze
end