Skip to content

Commit

Permalink
Load models first and organize inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
360dgries committed Oct 16, 2024
1 parent 6c584e4 commit 46c1055
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/fhir_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Dir.glob(File.join(root, 'fhir_client', 'sections', '**', '*.rb')).each do |file|
require file
end
require_relative 'fhir_client/ext/model' #require first so reference and bundle can inherit
Dir.glob(File.join(root, 'fhir_client', 'ext', '**', '*.rb')).each do |file|
require file
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fhir_client/ext/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ class Bundle

module FHIR
module R4B
class Bundle
class Bundle < FHIR::R4B::Model
include FHIR::BundleExtras
end
end
end

module FHIR
module R5
class Bundle
class Bundle < FHIR::R5::Model
include FHIR::BundleExtras
end
end
Expand Down
16 changes: 16 additions & 0 deletions lib/fhir_client/ext/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,19 @@ class Model
end
end
end

module FHIR
module R4B
class Model < FHIR::Model
include FHIR::ModelExtras
end
end
end

module FHIR
module R5
class Model < FHIR::Model
include FHIR::ModelExtras
end
end
end
6 changes: 3 additions & 3 deletions lib/fhir_client/ext/reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def resource_class

module FHIR
module STU3
class Reference
class Reference
include FHIR::ReferenceExtras

def resource_class
Expand All @@ -113,7 +113,7 @@ def resource_class

module FHIR
module R4B
class Reference
class Reference < FHIR::R4B::Model
include FHIR::ReferenceExtras

def resource_class
Expand All @@ -125,7 +125,7 @@ def resource_class

module FHIR
module R5
class Reference
class Reference < FHIR::R5::Model
include FHIR::ReferenceExtras

def resource_class
Expand Down

0 comments on commit 46c1055

Please sign in to comment.