Sha256: 40a7b970c16e3ef44f7ac9fe4c7f82a654da6749cd44b76cee8737aed435f641

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require 'ffaker/name'

module FFaker
  module NameUA
    extend ModuleUtils
    extend self

    FIRST_NAMES  = FIRST_NAMES_MALE + FIRST_NAMES_FEMALE
    LAST_NAMES   = LAST_NAMES_MALE + LAST_NAMES_FEMALE
    MIDDLE_NAMES = MIDDLE_NAMES_MALE + MIDDLE_NAMES_FEMALE

    def first_name_female
      fetch_sample(FIRST_NAMES_FEMALE)
    end

    def first_name_male
      fetch_sample(FIRST_NAMES_MALE)
    end

    def middle_name_female
      fetch_sample(MIDDLE_NAMES_FEMALE)
    end

    def middle_name_male
      fetch_sample(MIDDLE_NAMES_MALE)
    end

    def last_name_female
      fetch_sample(LAST_NAMES_FEMALE)
    end

    def last_name_male
      fetch_sample(LAST_NAMES_MALE)
    end

    def first_name
      fetch_sample(FIRST_NAMES)
    end

    def last_name
      fetch_sample(LAST_NAMES)
    end

    def name
      case rand(0..7)
      when 0 then first_name_male
      when 1 then first_name_female
      when 2 then "#{first_name_male} #{middle_name_male}"
      when 3 then "#{first_name_female} #{middle_name_male}"
      when 4 then "#{last_name_male} #{first_name_male}"
      when 5 then "#{last_name_female} #{first_name_female}"
      when 6 then "#{last_name_male} #{first_name_male} #{middle_name_male}"
      when 7 then "#{last_name_female} #{first_name_female} #{middle_name_female}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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