Class: Doubleshot::Dependencies::GemDependency
Instance Attribute Summary
Attributes inherited from Dependency
#name, #version
Instance Method Summary
collapse
Methods inherited from Dependency
#eql?, #hash, #lock, #locked?
Constructor Details
Returns a new instance of GemDependency.
7
8
9
10
|
# File 'lib/doubleshot/dependencies/gem_dependency.rb', line 7
def initialize(name)
super
@requirements = Set.new
end
|
Instance Method Details
#==(other) ⇒ Object
22
23
24
|
# File 'lib/doubleshot/dependencies/gem_dependency.rb', line 22
def ==(other)
eql?(other) && requirements == other.requirements
end
|
#add_requirement(requirement) ⇒ Object
16
17
18
19
20
|
# File 'lib/doubleshot/dependencies/gem_dependency.rb', line 16
def add_requirement(requirement)
requirement = Gem::Requirement.new(requirement)
@requirements << requirement
requirement
end
|
#requirements ⇒ Object
12
13
14
|
# File 'lib/doubleshot/dependencies/gem_dependency.rb', line 12
def requirements
ReadonlyCollection.new(@requirements)
end
|
#to_s(long_form = false) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/doubleshot/dependencies/gem_dependency.rb', line 26
def to_s(long_form = false)
if long_form && @version
"#{name}:#{version}"
else
@name
end
end
|