Sha256: b28b350545a90f3845f691d3267a12b20d5957ffcceedc5af25dc2c0fa6e76c5

Contents?: true

Size: 598 Bytes

Versions: 8

Compression:

Stored size: 598 Bytes

Contents

# encoding: utf-8

module Faker
  module Name
    extend ModuleUtils
    extend self

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

    def first_name
      FIRST_NAMES.rand
    end

    def last_name
      LAST_NAMES.rand
    end

    def prefix
      PREFIXES.rand
    end

    def suffix
      SUFFIXES.rand
    end

    PREFIXES = k %w(Mr. Mrs. Ms. Miss Dr.)
    SUFFIXES = k %w(Jr. Sr. I II III IV V MD DDS PhD DVM)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ffaker-1.30.0 lib/ffaker/name.rb
ffaker-1.25.0 lib/ffaker/name.rb
ffaker-1.24.0 lib/ffaker/name.rb
ffakerer-1.0.2 lib/ffakerer/name.rb
ffaker-1.23.0 lib/ffaker/name.rb
ffakerer-1.0.1 lib/ffakerer/name.rb
ffaker-1.22.1 lib/ffaker/name.rb
ffaker-1.22.0 lib/ffaker/name.rb