Sha256: 0f9a53fa22bc553a605319ea203ede25f841b949c89fada3b83c2c9e08452ee6

Contents?: true

Size: 519 Bytes

Versions: 9

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  module Locale
    extend ModuleUtils
    extend self

    def code(given_language = nil)
      code_index = LANGUAGE.index(given_language)
      return LANGUAGE_CODE[code_index] if given_language && code_index

      fetch_sample(LANGUAGE_CODE)
    end

    def language(given_code = nil)
      language_index = LANGUAGE_CODE.index(given_code&.upcase)
      return LANGUAGE[language_index] if given_code && language_index

      fetch_sample(LANGUAGE)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 lib/ffakerTW/locale.rb
ffakerTW-1.7.0 lib/ffakerTW/locale.rb
ffakerTW-1.6.0 lib/ffakerTW/locale.rb
ffakerTW-1.5.0 lib/ffakerTW/locale.rb
ffakerTW-1.4.0 lib/ffakerTW/locale.rb
ffakerTW-1.3.0 lib/ffakerTW/locale.rb
ffakerTW-1.2.0 lib/ffakerTW/locale.rb
ffakerTW-1.1.0 lib/ffakerTW/locale.rb
ffakerTW-0.1.0 lib/ffakerTW/locale.rb