Sha256: 6f5f2eba6737591c7b52697e2066c284c4976c738f50a063a4ed32b69f720108

Contents?: true

Size: 610 Bytes

Versions: 41

Compression:

Stored size: 610 Bytes

Contents

module Inferno
  module Terminology
    module BCP13
      @code_set = nil

      def self.code_set
        @code_set ||= parse_code_set
      end

      def self.parse_code_set
        require 'mime/types'
        cs_set = Set.new
        MIME::Types.each do |type|
          cs_set.add(system: 'urn:ietf:bcp:13', code: preprocess_code(type.simplified))
        end
        cs_set
      end

      # "preprocess" step for BCP13 codes, to remove any of the optional parameters
      # and downcase them
      def self.preprocess_code(code)
        code&.split(';')&.first&.downcase
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
onc_certification_g10_test_kit-7.0.1 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-7.0.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-6.0.3 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-6.0.2 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-6.0.1 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-6.0.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.4.2 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.4.1 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.3.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.2.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.1.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-5.0.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-4.1.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-4.0.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.8.1 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.8.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.7.2 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.7.1 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.7.0 lib/inferno/terminology/bcp_13.rb
onc_certification_g10_test_kit-3.6.0 lib/inferno/terminology/bcp_13.rb