Class: Inferno::TerminologyConfiguration
- Inherits:
-
Object
- Object
- Inferno::TerminologyConfiguration
- Defined in:
- lib/inferno/terminology/terminology_configuration.rb
Class Method Summary collapse
- .allowed_systems_metadata ⇒ Object
- .config ⇒ Object
- .explicitly_allowed_systems ⇒ Object
- .explicitly_prohibited_systems ⇒ Object
- .prohibited_license_restriction_levels ⇒ Object
- .prohibited_systems ⇒ Object
- .system_allowed?(url) ⇒ Boolean
- .system_prohibited?(url) ⇒ Boolean
Class Method Details
.allowed_systems_metadata ⇒ Object
15 16 17 18 19 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 15 def @allowed_systems_metadata ||= Terminology. .select { |url, | system_allowed?(url) } end |
.config ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 6 def config @config = if File.file? File.join('config', 'terminology_config.yml') YAML.load_file(File.join('config', 'terminology_config.yml')).presence || {} else {} end end |
.explicitly_allowed_systems ⇒ Object
32 33 34 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 32 def explicitly_allowed_systems config[:include] || [] end |
.explicitly_prohibited_systems ⇒ Object
36 37 38 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 36 def explicitly_prohibited_systems config[:exclude] || [] end |
.prohibited_license_restriction_levels ⇒ Object
28 29 30 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 28 def prohibited_license_restriction_levels config[:exclude_license_restriction_levels] || [] end |
.prohibited_systems ⇒ Object
21 22 23 24 25 26 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 21 def prohibited_systems @prohibited_systems ||= Terminology. .reject { |url, | system_allowed?(url) } .keys end |
.system_allowed?(url) ⇒ Boolean
40 41 42 43 44 45 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 40 def system_allowed?(url) return true if explicitly_allowed_systems.include?(url) return false if explicitly_prohibited_systems.include?(url) !prohibited_license_restriction_levels.include?(Terminology..dig(url, :restriction_level)) end |
.system_prohibited?(url) ⇒ Boolean
47 48 49 |
# File 'lib/inferno/terminology/terminology_configuration.rb', line 47 def system_prohibited?(url) !system_allowed?(url) end |