Module: Build::Dependency::Provider
- Defined in:
- lib/build/dependency/provider.rb
Instance Method Summary collapse
- #dependencies ⇒ IdentitySet<Dependency>
-
#depends(*names, **options) ⇒ Object
Add one or more dependencies to the provider.
- #depends?(name) ⇒ Boolean
- #filter(dependency) ⇒ Object
- #freeze ⇒ Object
-
#priority ⇒ Object
The default priority.
-
#priority=(value) ⇒ Object
Assign a priority.
-
#provides(*names, **aliases, &block) ⇒ Object
Add one or more provisions to the provider.
-
#provides?(dependency) ⇒ Boolean
Does this unit provide the named thing?.
- #provision_for(dependency) ⇒ Object
- #provisions ⇒ Object
- #resolution_for(dependency) ⇒ Object
Instance Method Details
#dependencies ⇒ IdentitySet<Dependency>
148 149 150 |
# File 'lib/build/dependency/provider.rb', line 148 def dependencies @dependencies ||= Set.new end |
#depends(*names, **options) ⇒ Object
Add one or more dependencies to the provider.
194 195 196 197 198 |
# File 'lib/build/dependency/provider.rb', line 194 def depends(*names, **) names.each do |name| dependencies << Depends.new(name, **) end end |
#depends?(name) ⇒ Boolean
200 201 202 |
# File 'lib/build/dependency/provider.rb', line 200 def depends?(name) dependencies.include?(name) end |
#filter(dependency) ⇒ Object
152 153 154 |
# File 'lib/build/dependency/provider.rb', line 152 def filter(dependency) provisions.select{|name, provision| dependency.match?(name)} end |
#freeze ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/build/dependency/provider.rb', line 123 def freeze return unless frozen? provisions.freeze dependencies.freeze super end |
#priority ⇒ Object
The default priority.
138 139 140 |
# File 'lib/build/dependency/provider.rb', line 138 def priority @priority ||= 0 end |
#priority=(value) ⇒ Object
Assign a priority.
133 134 135 |
# File 'lib/build/dependency/provider.rb', line 133 def priority= value @priority = value end |
#provides(*names, **aliases, &block) ⇒ Object
Add one or more provisions to the provider.
178 179 180 181 182 183 184 185 186 |
# File 'lib/build/dependency/provider.rb', line 178 def provides(*names, **aliases, &block) names.each do |name| provisions[name] = Provision.new(name, self, block) end aliases.each do |name, dependencies| provisions[name] = Alias.new(name, self, Array(dependencies)) end end |
#provides?(dependency) ⇒ Boolean
Does this unit provide the named thing?
157 158 159 |
# File 'lib/build/dependency/provider.rb', line 157 def provides?(dependency) provisions.key?(dependency.name) end |
#provision_for(dependency) ⇒ Object
161 162 163 |
# File 'lib/build/dependency/provider.rb', line 161 def provision_for(dependency) return provisions[dependency.name] end |
#provisions ⇒ Object
143 144 145 |
# File 'lib/build/dependency/provider.rb', line 143 def provisions @provisions ||= {} end |
#resolution_for(dependency) ⇒ Object
165 166 167 |
# File 'lib/build/dependency/provider.rb', line 165 def resolution_for(dependency) return Resolution.new(provision_for(dependency), dependency) end |