Class: Appraisal::DependencyList
- Inherits:
-
Object
- Object
- Appraisal::DependencyList
- Defined in:
- lib/appraisal/dependency_list.rb
Instance Method Summary collapse
- #add(name, requirements) ⇒ Object
-
#for_dup ⇒ Object
:nodoc:.
-
#initialize ⇒ DependencyList
constructor
A new instance of DependencyList.
- #remove(name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ DependencyList
Returns a new instance of DependencyList.
8 9 10 11 |
# File 'lib/appraisal/dependency_list.rb', line 8 def initialize @dependencies = {} @removed_dependencies = Set.new end |
Instance Method Details
#add(name, requirements) ⇒ Object
13 14 15 16 17 |
# File 'lib/appraisal/dependency_list.rb', line 13 def add(name, requirements) unless @removed_dependencies.include?(name) @dependencies[name] = Dependency.new(name, requirements) end end |
#for_dup ⇒ Object
:nodoc:
30 31 32 |
# File 'lib/appraisal/dependency_list.rb', line 30 def for_dup @dependencies.values.map(&:for_dup).join("\n") end |
#remove(name) ⇒ Object
19 20 21 22 23 |
# File 'lib/appraisal/dependency_list.rb', line 19 def remove(name) if @removed_dependencies.add?(name) @dependencies.delete(name) end end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/appraisal/dependency_list.rb', line 25 def to_s @dependencies.values.map(&:to_s).join("\n") end |