Sha256: ffee08ea960dc5e8a44af23d095f35b0ee1434a452554e0d69315ee07009226f

Contents?: true

Size: 918 Bytes

Versions: 16

Compression:

Stored size: 918 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
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
countries-5.7.1 lib/countries/country/emoji.rb
countries-5.7.0 lib/countries/country/emoji.rb
countries-5.6.0 lib/countries/country/emoji.rb
countries-5.5.0 lib/countries/country/emoji.rb
countries-5.4.0 lib/countries/country/emoji.rb
countries-5.3.2 lib/countries/country/emoji.rb
countries-5.3.1 lib/countries/country/emoji.rb
countries-5.3.0 lib/countries/country/emoji.rb
countries-5.2.1 lib/countries/country/emoji.rb
countries-5.2.0 lib/countries/country/emoji.rb
countries-5.1.2 lib/countries/country/emoji.rb
countries-5.1.1 lib/countries/country/emoji.rb
countries-5.1.0 lib/countries/country/emoji.rb
countries-5.0.2 lib/countries/country/emoji.rb
countries-5.0.1 lib/countries/country/emoji.rb
countries-5.0.0 lib/countries/country/emoji.rb