Sha256: d250ab2f7f8551f02fc6629eb13f3689e9cb0158912535de1b3877f9b0ea7191

Contents?: true

Size: 316 Bytes

Versions: 3

Compression:

Stored size: 316 Bytes

Contents

# frozen_string_literal: true

require 'yaml'

module SoapyBing
  class CountryCodes
    YML_FILE_PATH = File.join(__dir__, 'country_codes.yml').freeze

    def initialize
      @country_codes = YAML.safe_load(File.read(YML_FILE_PATH))
    end

    def code(id)
      @country_codes.fetch(id.to_s)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soapy_bing-1.0.1 lib/soapy_bing/country_codes.rb
soapy_bing-1.0.0 lib/soapy_bing/country_codes.rb
soapy_bing-0.4.0 lib/soapy_bing/country_codes.rb