Class: Librarian::Dependency
- Inherits:
-
Object
- Object
- Librarian::Dependency
- Defined in:
- lib/librarian/dependency.rb
Defined Under Namespace
Classes: Requirement
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#requirement ⇒ Object
readonly
Returns the value of attribute requirement.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #cache_manifests! ⇒ Object
- #consistent_with?(other) ⇒ Boolean
- #inconsistent_with?(other) ⇒ Boolean
-
#initialize(name, requirement, source) ⇒ Dependency
constructor
A new instance of Dependency.
- #manifests ⇒ Object
- #satisfied_by?(manifest) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name, requirement, source) ⇒ Dependency
Returns a new instance of Dependency.
102 103 104 105 106 107 108 109 110 |
# File 'lib/librarian/dependency.rb', line 102 def initialize(name, requirement, source) assert_name_valid! name self.name = name self.requirement = Requirement.new(requirement) self.source = source @manifests = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
99 100 101 |
# File 'lib/librarian/dependency.rb', line 99 def name @name end |
#requirement ⇒ Object
Returns the value of attribute requirement.
99 100 101 |
# File 'lib/librarian/dependency.rb', line 99 def requirement @requirement end |
#source ⇒ Object
Returns the value of attribute source.
99 100 101 |
# File 'lib/librarian/dependency.rb', line 99 def source @source end |
Instance Method Details
#==(other) ⇒ Object
128 129 130 131 132 133 134 |
# File 'lib/librarian/dependency.rb', line 128 def ==(other) !other.nil? && self.class == other.class && self.name == other.name && self.requirement == other.requirement && self.source == other.source end |
#cache_manifests! ⇒ Object
116 117 118 |
# File 'lib/librarian/dependency.rb', line 116 def cache_manifests! source.manifests(name) end |
#consistent_with?(other) ⇒ Boolean
136 137 138 |
# File 'lib/librarian/dependency.rb', line 136 def consistent_with?(other) name != other.name || requirement.consistent_with?(other.requirement) end |
#inconsistent_with?(other) ⇒ Boolean
140 141 142 |
# File 'lib/librarian/dependency.rb', line 140 def inconsistent_with?(other) !consistent_with?(other) end |
#manifests ⇒ Object
112 113 114 |
# File 'lib/librarian/dependency.rb', line 112 def manifests @manifests ||= cache_manifests! end |
#satisfied_by?(manifest) ⇒ Boolean
120 121 122 |
# File 'lib/librarian/dependency.rb', line 120 def satisfied_by?(manifest) manifest.satisfies?(self) end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/librarian/dependency.rb', line 124 def to_s "#{name} (#{requirement}) <#{source}>" end |