Class: HealthcarePhony::EthnicGroup
- Inherits:
-
Object
- Object
- HealthcarePhony::EthnicGroup
- Defined in:
- lib/healthcare_phony/ethnic_group.rb
Overview
Public: Randomly generates an ethnic group
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#coding_system ⇒ Object
Returns the value of attribute coding_system.
-
#description ⇒ Object
Returns the value of attribute description.
Instance Method Summary collapse
-
#initialize(init_args = {}) ⇒ EthnicGroup
constructor
Public: Initializes an EthnicGroup.
Constructor Details
#initialize(init_args = {}) ⇒ EthnicGroup
Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes: blank - An integer representing the % of times EthnicGroup components should be blank. ethnic_group_data_file - YAML file containing ethnic group information to randomly choose from if different options than those that come with gem are desired. See ethnic_group.yml for default values.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/healthcare_phony/ethnic_group.rb', line 15 def initialize(init_args = {}) @set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == '' data_file = if !init_args[:ethnic_group_data_file].nil? init_args[:ethnic_group_data_file] else "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/ethnic_group.yml" end e_array = Psych.load_file(data_file) random_ethnic = e_array.nil? ? '' : e_array.sample @code = @set_blank == true ? '' : random_ethnic[:code] @description = @set_blank == true ? '' : random_ethnic[:description] @coding_system = @set_blank == true ? '' : random_ethnic[:coding_system] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/healthcare_phony/ethnic_group.rb', line 6 def code @code end |
#coding_system ⇒ Object
Returns the value of attribute coding_system.
6 7 8 |
# File 'lib/healthcare_phony/ethnic_group.rb', line 6 def coding_system @coding_system end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/healthcare_phony/ethnic_group.rb', line 6 def description @description end |