Class: HealthcarePhony::Religion

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

Overview

Public: Creates a Religion object for a Patient by randomly choosing a value from a YAML file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(init_args = {}) ⇒ Religion

Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes: religion_data_file - YAML file containing religion information to randomly choose from if different options than those that come with gem are desired. See religion.yml for default values.



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

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[:religion_data_file].nil?
                init_args[:religion_data_file]
              else
                "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/religion.yml"
              end
  r_array = Psych.load_file(data_file)

  random_religion = r_array.nil? ? '' : r_array.sample

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

Instance Attribute Details

#codeObject

Returns the value of attribute code.



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

def code
  @code
end

#coding_systemObject

Returns the value of attribute coding_system.



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

def coding_system
  @coding_system
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end