Class: Toys::SourceList
- Inherits:
-
Object
- Object
- Toys::SourceList
- Defined in:
- core-docs/toys/source_list.rb
Overview
An ordered collection of root sources for the Loader, held as unresolved SourceSpec objects. Use this class to build a list of sources, and then pass it to the Loader constructor.
Each spec added to the list occupies its own priority level, and resolves to a single root source. This is an invariant the Loader relies on.
A source list resolves nothing. The specs it holds describe sources; the Loader turns them into SourceInfo objects when it first needs them.
Not thread-safe. Callers should ensure that access is single-threaded or synchronized.
Defined in the toys-core gem
Instance Method Summary collapse
-
#add(spec, high_priority: false) ⇒ self
Add a source spec to the list, assigning it the next priority.
-
#each_with_priority {|Toys::SourceSpec::Base, Integer| ... } ⇒ self, Enumerator
Iterate over the source specs and their assigned priorities, in the order in which they were added.
-
#empty? ⇒ boolean
Determines whether the list is empty.
-
#initialize ⇒ SourceList
constructor
Create an empty source list.
-
#size ⇒ Integer
Returns the size of the list.
Constructor Details
#initialize ⇒ SourceList
Create an empty source list.
23 24 25 |
# File 'core-docs/toys/source_list.rb', line 23 def initialize # Source available in the toys-core gem end |
Instance Method Details
#add(spec, high_priority: false) ⇒ self
Add a source spec to the list, assigning it the next priority.
68 69 70 |
# File 'core-docs/toys/source_list.rb', line 68 def add(spec, high_priority: false) # Source available in the toys-core gem end |
#each_with_priority {|Toys::SourceSpec::Base, Integer| ... } ⇒ self, Enumerator
Iterate over the source specs and their assigned priorities, in the order in which they were added.
53 54 55 |
# File 'core-docs/toys/source_list.rb', line 53 def each_with_priority # Source available in the toys-core gem end |
#empty? ⇒ boolean
Determines whether the list is empty.
32 33 34 |
# File 'core-docs/toys/source_list.rb', line 32 def empty? # Source available in the toys-core gem end |
#size ⇒ Integer
Returns the size of the list.
41 42 43 |
# File 'core-docs/toys/source_list.rb', line 41 def size # Source available in the toys-core gem end |