Sha256: da2594dc04ae340ca9f3f0c0eb837fa05238e4302e293377c2e2f120ab56e3dc

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

module ISO3166
  module Emoji
    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

    # @return [String] the emoji flag for this country
    #
    # The emoji flag for this country, using Unicode Regional Indicator characters. e.g: "U+1F1FA U+1F1F8" for 🇺🇸
    def emoji_flag
      alpha2.downcase.chars.map { |c| CODE_POINTS[c] }.join.freeze
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
countries-7.0.0 lib/countries/country/emoji.rb
countries-6.0.0 lib/countries/country/emoji.rb
countries-5.7.2 lib/countries/country/emoji.rb