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