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.
6 7 8 9 |
# File 'lib/appraisal/dependency_list.rb', line 6 def initialize @dependencies = Hash.new @removed_dependencies = Set.new end |
Instance Method Details
#add(name, requirements) ⇒ Object
11 12 13 14 15 |
# File 'lib/appraisal/dependency_list.rb', line 11 def add(name, requirements) unless @removed_dependencies.include?(name) @dependencies[name] = Dependency.new(name, requirements) end end |
#for_dup ⇒ Object
:nodoc:
28 29 30 |
# File 'lib/appraisal/dependency_list.rb', line 28 def for_dup @dependencies.values.map(&:for_dup).join("\n") end |
#remove(name) ⇒ Object
17 18 19 20 21 |
# File 'lib/appraisal/dependency_list.rb', line 17 def remove(name) if @removed_dependencies.add?(name) @dependencies.delete(name) end end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/appraisal/dependency_list.rb', line 23 def to_s @dependencies.values.map(&:to_s).join("\n") end |