Class: FhirPackagesManager::IgnoreList
- Inherits:
-
Object
- Object
- FhirPackagesManager::IgnoreList
- Defined in:
- lib/fhir_packages_manager/ignore_list.rb
Overview
A list of packages (optionally pinned to a version) to skip when fetching.
Loaded from a YAML or JSON file containing a flat array, e.g.:
- hl7.fhir.r4.core # ignore every version of this package
- name: hl7.fhir.us.core
version: 3.1.0 # ignore only this one version
Class Method Summary collapse
-
.load(path) ⇒ IgnoreList
Loads an ignore list from a YAML or JSON file (JSON iff the extension is .json).
Instance Method Summary collapse
-
#ignored?(name, version = nil) ⇒ Boolean
True if this name/version is on the ignore list.
-
#initialize(entries = []) ⇒ IgnoreList
constructor
A new instance of IgnoreList.
Constructor Details
#initialize(entries = []) ⇒ IgnoreList
Returns a new instance of IgnoreList.
32 33 34 |
# File 'lib/fhir_packages_manager/ignore_list.rb', line 32 def initialize(entries = []) @entries = entries.map { |entry| normalize(entry) } end |
Class Method Details
.load(path) ⇒ IgnoreList
Loads an ignore list from a YAML or JSON file (JSON iff the extension is .json).
19 20 21 22 23 24 25 26 27 |
# File 'lib/fhir_packages_manager/ignore_list.rb', line 19 def self.load(path) data = case File.extname(path).downcase when '.json' JSON.parse(File.read(path)) else YAML.load_file(path) end new(data || []) end |
Instance Method Details
#ignored?(name, version = nil) ⇒ Boolean
Returns true if this name/version is on the ignore list.
39 40 41 |
# File 'lib/fhir_packages_manager/ignore_list.rb', line 39 def ignored?(name, version = nil) @entries.any? { |entry| matches?(entry, name, version) } end |