Class: FHIR::Reference
- Inherits:
-
Object
- Object
- FHIR::Reference
- Defined in:
- lib/fhir_client/ext/reference.rb
Instance Method Summary collapse
Instance Method Details
#contained? ⇒ Boolean
3 4 5 |
# File 'lib/fhir_client/ext/reference.rb', line 3 def contained? reference.to_s.start_with?('#') end |
#id ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fhir_client/ext/reference.rb', line 7 def id if contained? reference.to_s[1..-1] else reference.to_s.split('/').last end end |
#read ⇒ Object
23 24 25 26 |
# File 'lib/fhir_client/ext/reference.rb', line 23 def read return if contained? || type.blank? || id.blank? resource_class.read(id, client) end |
#resource_class ⇒ Object
19 20 21 |
# File 'lib/fhir_client/ext/reference.rb', line 19 def resource_class "FHIR::#{type}".constantize unless contained? end |
#type ⇒ Object
15 16 17 |
# File 'lib/fhir_client/ext/reference.rb', line 15 def type reference.to_s.split('/').first unless contained? end |