Sha256: ebeaa7377573cdbd8ceb55954e7bb9a3bfa4a52bd3a75012bd19c0ad3c04db5f

Contents?: true

Size: 536 Bytes

Versions: 6

Compression:

Stored size: 536 Bytes

Contents

# encoding: utf-8

module Faker
  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
        LANGUAGE_CODE.sample
      end
    end

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

  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/locale.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/locale.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/locale.rb
ffaker-1.32.1 lib/ffaker/locale.rb
ffaker-1.32.0 lib/ffaker/locale.rb
ffaker-1.31.0 lib/ffaker/locale.rb