Class: HealthcarePhony::Race
- Inherits:
-
Object
- Object
- HealthcarePhony::Race
- Defined in:
- lib/healthcare_phony/race.rb
Overview
Public: Creates a Race by randomly choosing values from a YAML file.
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 = {}) ⇒ Race
constructor
Public: Initializes an Address.
Constructor Details
#initialize(init_args = {}) ⇒ Race
Public: Initializes an Address. Pass in hash of different parameters, currently this includes: race_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the gem supplied file will be used. The default file race.yml.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/healthcare_phony/race.rb', line 13 def initialize(init_args = {}) # TODO: allow a way for caller to pass in % blank # TODO: set coding system data_file = if !init_args[:race_data_file].nil? init_args[:race_data_file] else "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/race.yml" end race_array = Psych.load_file(data_file) random_race = race_array.nil? ? '' : race_array.sample @code = random_race[:code] @description = random_race[:description] @coding_system = '' end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/healthcare_phony/race.rb', line 6 def code @code end |
#coding_system ⇒ Object
Returns the value of attribute coding_system.
6 7 8 |
# File 'lib/healthcare_phony/race.rb', line 6 def coding_system @coding_system end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/healthcare_phony/race.rb', line 6 def description @description end |