Sha256: 6f3bbb02eead60d9340dec6d259ce60ce35eb6fbc730f9d607047420ae0c11d0

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

# encoding: utf-8

module FFaker
  # Author PapePathe<pathe.sene@gmail.com> github.com/PapePathe
  # The names & first names in this module were found at this url:
  # http://www.senegalaisement.com/senegal/noms_et_prenoms.html
  module NameSN
    extend ModuleUtils
    extend self

    PREFIX_FEMALE = %w[adja adjaratou mame ndeye].freeze
    PREFIX_MALE = %w[pape eladji mame serigne].freeze

    def last_name
      fetch_sample(LAST_NAMES)
    end

    def first_name_male
      fetch_sample(FIRST_NAMES_MALE)
    end

    def first_name_female
      fetch_sample(FIRST_NAMES_FEMALE)
    end

    def prefix_male
      fetch_sample(PREFIX_MALE)
    end

    def prefix_female
      fetch_sample(PREFIX_FEMALE)
    end

    def name_male
      case rand(0..9)
      when 5, 7 then "#{prefix_male} #{first_name_male} #{last_name}"
      else           "#{first_name_male} #{last_name}"
      end
    end

    def name_female
      case rand(0..9)
      when 5, 7 then "#{prefix_female} #{first_name_female} #{last_name}"
      else           "#{first_name_female} #{last_name}"
      end
    end

    def name_sn
      case rand(0..5)
      when 0 then "#{prefix_female} #{first_name_female} #{last_name}"
      when 1 then "#{prefix_male} #{first_name_male} #{last_name}"
      when 2 then "#{first_name_male} #{last_name}"
      when 3 then "#{first_name_female} #{last_name}"
      when 4 then "#{first_name_male} #{last_name}"
      else        "#{first_name_female} #{last_name}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-2.11.0 lib/ffaker/name_sn.rb
ffaker-2.10.0 lib/ffaker/name_sn.rb
ffaker-2.9.0 lib/ffaker/name_sn.rb
ffaker-2.8.1 lib/ffaker/name_sn.rb
ffaker-2.8.0 lib/ffaker/name_sn.rb
ffaker-2.7.0 lib/ffaker/name_sn.rb