Class: SemanticPuppet::Dependency::ModuleRelease
- Inherits:
-
Object
- Object
- SemanticPuppet::Dependency::ModuleRelease
show all
- Includes:
- GraphNode
- Defined in:
- lib/semantic_puppet/dependency/module_release.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from GraphNode
#<<, #add_constraint, #add_dependency, #children, #constraints, #constraints_for, #dependencies, #dependency_names, #populate_children, #satisfied?, #satisfies_constraints?, #satisfies_dependency?
Constructor Details
#initialize(source, name, version, dependencies = {}) ⇒ ModuleRelease
Create a new instance of a module release.
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 16
def initialize(source, name, version, dependencies = {})
@source = source
@name = name.freeze
@version = version.freeze
dependencies.each do |name, range|
add_constraint('initialize', name, range.to_s) do |node|
range === node.version
end
add_dependency(name)
end
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8
9
10
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 8
def name
@name
end
|
#version ⇒ Object
Returns the value of attribute version.
8
9
10
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 8
def version
@version
end
|
Instance Method Details
#<=>(oth) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 34
def <=>(oth)
our_key = [ priority, name, version ]
their_key = [ oth.priority, oth.name, oth.version ]
return our_key <=> their_key
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
41
42
43
44
45
46
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 41
def eql?(other)
other.is_a?(ModuleRelease) &&
@name.eql?(other.name) &&
@version.eql?(other.version) &&
dependencies.eql?(other.dependencies)
end
|
#hash ⇒ Object
49
50
51
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 49
def hash
@name.hash ^ @version.hash
end
|
#priority ⇒ Object
30
31
32
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 30
def priority
@source.priority
end
|
#to_s ⇒ Object
53
54
55
|
# File 'lib/semantic_puppet/dependency/module_release.rb', line 53
def to_s
"#<#{self.class} #{name}@#{version}>"
end
|