Sha256: 525792b6f4cf8f109e1a508f31eac5d31879c6815f94eadda3966781e2706d98

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module FFaker
  module NameID
    extend ModuleUtils
    extend self

    MALE_PREFIXES = %w[Tn.].freeze
    FEMALE_PREFIXES = %w[Ny. Nn.].freeze
    PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES).freeze
    FIRST_NAMES = (FIRST_NAMES_FEMALE + FIRST_NAMES_MALE).freeze

    def name
      "#{first_name} #{last_name}"
    end

    def name_with_prefix
      fetch_sample(
        [
          female_name_with_prefix,
          male_name_with_prefix
        ]
      )
    end

    def female_name_with_prefix
      "#{female_prefix} #{first_name_female} #{last_name}"
    end

    def male_name_with_prefix
      "#{male_prefix} #{first_name_male} #{last_name}"
    end

    def first_name
      fetch_sample(FIRST_NAMES)
    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

    def female_prefix
      fetch_sample(FEMALE_PREFIXES)
    end

    def male_prefix
      fetch_sample(MALE_PREFIXES)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ffaker-2.23.0 lib/ffaker/name_id.rb
ffaker-2.22.0 lib/ffaker/name_id.rb
ffaker-2.21.0 lib/ffaker/name_id.rb
ffaker-2.20.0 lib/ffaker/name_id.rb
ffaker-2.19.0 lib/ffaker/name_id.rb
ffaker-2.18.0 lib/ffaker/name_id.rb
ffaker-2.17.0 lib/ffaker/name_id.rb
ffaker-2.16.0 lib/ffaker/name_id.rb
ffaker-2.15.0 lib/ffaker/name_id.rb
ffaker-2.14.0 lib/ffaker/name_id.rb
ffaker-2.13.0 lib/ffaker/name_id.rb
ffaker-2.12.0 lib/ffaker/name_id.rb