Class: Minipack::ManifestRepository
- Inherits:
-
Object
- Object
- Minipack::ManifestRepository
- Defined in:
- lib/minipack/manifest_repository.rb
Defined Under Namespace
Classes: NotFoundError
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
Instance Method Summary collapse
- #add(key, path, **options) ⇒ Object
- #all_manifests ⇒ Object
- #get(key) ⇒ Object
-
#initialize ⇒ ManifestRepository
constructor
A new instance of ManifestRepository.
Constructor Details
#initialize ⇒ ManifestRepository
Returns a new instance of ManifestRepository.
9 10 11 12 |
# File 'lib/minipack/manifest_repository.rb', line 9 def initialize @manifests = {} @default = nil # a pointer to a default manifest end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
7 8 9 |
# File 'lib/minipack/manifest_repository.rb', line 7 def default @default end |
Instance Method Details
#add(key, path, **options) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/minipack/manifest_repository.rb', line 19 def add(key, path, **) manifest = Minipack::Manifest.new(path, **) # Mark a first one as a default @default = manifest if @manifests.empty? @manifests[key.to_sym] = manifest end |
#all_manifests ⇒ Object
14 15 16 |
# File 'lib/minipack/manifest_repository.rb', line 14 def all_manifests @manifests.values end |
#get(key) ⇒ Object
26 27 28 |
# File 'lib/minipack/manifest_repository.rb', line 26 def get(key) @manifests[key.to_sym] || raise(NotFoundError, "manifest associated with #{key} not found") end |