class HealthcarePhony::Gender

Public: Randomly generates a Gender.

Attributes

code[RW]
description[RW]

Public Class Methods

new(init_args = {}) click to toggle source

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.

# File lib/healthcare_phony/gender.rb, line 11
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