Sha256: ee78287e0e1c430634a5910741cd3a88bf7686a917d3612a93c398c3aaaa43da

Contents?: true

Size: 564 Bytes

Versions: 10

Compression:

Stored size: 564 Bytes

Contents

# encoding: utf-8

module FFaker
  module Locale
    extend ModuleUtils
    extend self

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ffaker-2.11.0 lib/ffaker/locale.rb
ffaker-2.10.0 lib/ffaker/locale.rb
ffaker-2.9.0 lib/ffaker/locale.rb
ffaker-2.8.1 lib/ffaker/locale.rb
ffaker-2.8.0 lib/ffaker/locale.rb
ffaker-2.7.0 lib/ffaker/locale.rb
ffaker-2.6.0 lib/ffaker/locale.rb
ffaker-2.5.0 lib/ffaker/locale.rb
ffaker-2.4.0 lib/ffaker/locale.rb
ffaker-2.3.0 lib/ffaker/locale.rb