Sha256: 0713bcff232c0b5a58486fda08b28172ddecc667c358ed832d423421d3d66248

Contents?: true

Size: 862 Bytes

Versions: 5

Compression:

Stored size: 862 Bytes

Contents

# encoding: utf-8

require 'ffaker/name'

module Faker
  module NameSE
    include Faker::Name

    extend ModuleUtils
    extend self

    PREFIXES = %w(Dr. Prof.)

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

    def first_name
      case rand(12)
      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}"
      else            first_name_female
      end
    end

    def first_name_female
      FIRST_NAMES_FEMALE.sample
    end

    def first_name_male
      FIRST_NAMES_MALE.sample
    end

    def last_name
      LAST_NAMES.sample
    end

    def prefix
      PREFIXES.sample
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

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