Sha256: f8a4b5bd929da60adb30f54dfe47832700aebf628f5e4f62176a3add80bbf666

Contents?: true

Size: 733 Bytes

Versions: 4

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

module HealthcarePhony
  # Public: Randomly generates a Gender.
  class Gender
    attr_accessor :code,
                  :description

    # Public: Initializes a Gender. Pass in hash of different parameters, currently this includes:
    # blank - An integer representing the % of times Address components should be blank.
    def initialize(init_args = {})
      @description = %w[Female Male Unknown].sample

      @description = if !init_args[:blank].nil?
                       Helper.random_with_blank(@description, init_args[:blank])
                     else
                       @description
                     end
      @code = @description == '' ? '' : @description[0]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
healthcare_phony-0.7.0 lib/healthcare_phony/gender.rb
healthcare_phony-0.6.0 lib/healthcare_phony/gender.rb
healthcare_phony-0.5.1 lib/healthcare_phony/gender.rb
healthcare_phony-0.5.0 lib/healthcare_phony/gender.rb