Sha256: 461dc7e11bfe792e277dd151b4b5c7ffbbaeed71a67d4d9e9920a296ab48a8ef

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 KB

Contents

# unpack locale
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2015-07-28 original script

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module Locale

                    def self.unpack(hLocale, responseObj)

                        # return nil object if input is empty
                        intLocale = nil
                        return if hLocale.empty?

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intLocale = intMetadataClass.newLocale

                        # locale - language
                        if hLocale.has_key?('language')
                            s = hLocale['language']
                            if s != ''
                                intLocale[:languageCode] = s
                            end
                        end

                        # locale - country
                        if hLocale.has_key?('country')
                            s = hLocale['country']
                            if s != ''
                                intLocale[:countryCode] = s
                            end
                        end

                        # locale - character set
                        if hLocale.has_key?('characterSet')
                            s = hLocale['characterSet']
                            if s != ''
                                intLocale[:characterEncoding] = s
                            end
                        end

                        return intLocale

                    end

                end

            end
        end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
adiwg-mdtranslator-1.4.0 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta14 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta13 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta12 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta11 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta10 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta9 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta8 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta7 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta6 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta5 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta4 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta3 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta2 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.4.0.beta1 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb
adiwg-mdtranslator-1.3.0 lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb