Class: Builtins::Helpers::DependencyHandler
- Inherits:
-
Object
- Object
- Builtins::Helpers::DependencyHandler
- Defined in:
- lib/builtins/helpers/dependency_handler.rb
Instance Method Summary collapse
- #dependencies ⇒ Object
- #dependencies_for(type, names) ⇒ Object
-
#initialize(dependency_set) ⇒ DependencyHandler
constructor
A new instance of DependencyHandler.
Constructor Details
#initialize(dependency_set) ⇒ DependencyHandler
Returns a new instance of DependencyHandler.
6 7 8 |
# File 'lib/builtins/helpers/dependency_handler.rb', line 6 def initialize(dependency_set) @dependency_set = dependency_set end |
Instance Method Details
#dependencies ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/builtins/helpers/dependency_handler.rb', line 10 def dependencies return [] unless @dependency_set @dependency_set.map do |type, names| dependencies_for(type, names) end.flatten.compact end |
#dependencies_for(type, names) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/builtins/helpers/dependency_handler.rb', line 18 def dependencies_for(type, names) dependency_class = Dependencies.const_get(type.capitalize.to_sym, false) names.map { |name| dependency_class.new(name) } rescue NameError Output.error("No way to handle dependencies of type '#{type}'; ignoring.") end |