Class: HealthcarePhony::Identifier
- Inherits:
-
Object
- Object
- HealthcarePhony::Identifier
- Defined in:
- lib/healthcare_phony/identifier.rb
Overview
Public: Randomly generates an identifier.
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#identifier_type_code ⇒ Object
Returns the value of attribute identifier_type_code.
Instance Method Summary collapse
-
#initialize(**init_args) ⇒ Identifier
constructor
Public: Initializes an Address.
Constructor Details
#initialize(**init_args) ⇒ Identifier
Public: Initializes an Address. Pass in hash of different parameters, currently this includes: type_code - Identifier Type Code, example PID.3.5. HL7 Data Table 0203 pattern - Regex pattern used to randomly generate the identifier. Default is d10 which would generate an identifier like 5992657933.
15 16 17 18 19 20 21 |
# File 'lib/healthcare_phony/identifier.rb', line 15 def initialize(**init_args) @identifier_type_code = init_args[:type_code].nil? ? '' : init_args[:type_code] identifier_pattern = init_args[:pattern].nil? ? '\d{10}' : init_args[:pattern] @identifier = Regexp.new(identifier_pattern).random_example end |
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
8 9 10 |
# File 'lib/healthcare_phony/identifier.rb', line 8 def identifier @identifier end |
#identifier_type_code ⇒ Object
Returns the value of attribute identifier_type_code.
8 9 10 |
# File 'lib/healthcare_phony/identifier.rb', line 8 def identifier_type_code @identifier_type_code end |