Class: Appraisal::DependencyList

Inherits:
Object
  • Object
show all
Defined in:
lib/appraisal/dependency_list.rb

Instance Method Summary collapse

Constructor Details

#initializeDependencyList

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_dupObject

: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_sObject



25
26
27
# File 'lib/appraisal/dependency_list.rb', line 25

def to_s
  @dependencies.values.map(&:to_s).join("\n")
end