Class: HealthcarePhony::MaritalStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/healthcare_phony/marital_status.rb

Overview

Public: Generates a random MaritalStatus using data from a YAML file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**init_args) ⇒ MaritalStatus

Public: Initializes an Address. Pass in hash of different parameters, currently this includes: marital_status_data_file - Location of YAML file containing Language data (Code, Description, and Coding System) if a different set of random values is desired. Otherwise the default file marital_status.yml will be used.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/healthcare_phony/marital_status.rb', line 13

def initialize(**init_args)
  # TODO: allow a way for caller to pass in a custom set of codes to choose from
  # TODO: allow a way for caller to pass in % blank

  data_file = if !init_args[:marital_status_data_file].nil?
                init_args[:marital_status_data_file]
              else
                "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/marital_status.yml"
              end
  ms_array = Psych.load_file(data_file)

  random_ms = ms_array.nil? ? '' : ms_array.sample

  @code = random_ms[:code]
  @description = random_ms[:description]
  @coding_system = random_ms[:coding_system]
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



6
7
8
# File 'lib/healthcare_phony/marital_status.rb', line 6

def code
  @code
end

#coding_systemObject

Returns the value of attribute coding_system.



6
7
8
# File 'lib/healthcare_phony/marital_status.rb', line 6

def coding_system
  @coding_system
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/healthcare_phony/marital_status.rb', line 6

def description
  @description
end