Sha256: 83c97fdd8b7e0cf77f032cdb8b483fe8f077ad65f914bb54af8f26b22b659b47

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true

require 'ffaker/name'

module FFaker
  module NameNB
    include FFaker::Name

    extend ModuleUtils
    extend self

    PREFIXES = %w[Dr. Prof.].freeze

    def name
      case rand(0..29)
      when 0 then "#{prefix} #{first_name} #{last_name}"
      else        "#{first_name} #{last_name}"
      end
    end

    def first_name
      case rand(0..11)
      when 0..4  then first_name_female
      when 5..9  then first_name_male
      when 10    then "#{first_name_male} #{first_name_male}"
      when 11    then "#{first_name_female} #{first_name_female}"
      end
    end

    def first_name_female
      fetch_sample(FIRST_NAMES_FEMALE)
    end

    def first_name_male
      fetch_sample(FIRST_NAMES_MALE)
    end

    def last_name
      fetch_sample(LAST_NAMES)
    end

    def prefix
      fetch_sample(PREFIXES)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-2.17.0 lib/ffaker/name_nb.rb
ffaker-2.16.0 lib/ffaker/name_nb.rb
ffaker-2.15.0 lib/ffaker/name_nb.rb
ffaker-2.14.0 lib/ffaker/name_nb.rb
ffaker-2.13.0 lib/ffaker/name_nb.rb
ffaker-2.12.0 lib/ffaker/name_nb.rb