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.


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_dupObject

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


23
24
25
# File 'lib/appraisal/dependency_list.rb', line 23

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