class Librarian::Dependency

Attributes

name[RW]
requirement[RW]
source[RW]

Public Class Methods

new(name, requirement, source) click to toggle source
# 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

Public Instance Methods

==(other) click to toggle source
# 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!() click to toggle source
# File lib/librarian/dependency.rb, line 116
def cache_manifests!
  source.manifests(name)
end
consistent_with?(other) click to toggle source
# File lib/librarian/dependency.rb, line 136
def consistent_with?(other)
  name != other.name || requirement.consistent_with?(other.requirement)
end
inconsistent_with?(other) click to toggle source
# File lib/librarian/dependency.rb, line 140
def inconsistent_with?(other)
  !consistent_with?(other)
end
manifests() click to toggle source
# File lib/librarian/dependency.rb, line 112
def manifests
  @manifests ||= cache_manifests!
end
satisfied_by?(manifest) click to toggle source
# File lib/librarian/dependency.rb, line 120
def satisfied_by?(manifest)
  manifest.satisfies?(self)
end
to_s() click to toggle source
# File lib/librarian/dependency.rb, line 124
def to_s
  "#{name} (#{requirement}) <#{source}>"
end

Private Instance Methods

assert_name_valid!(name) click to toggle source
# File lib/librarian/dependency.rb, line 146
def assert_name_valid!(name)
  name =~ /\A\S(?:.*\S)?\z/ and return

  raise ArgumentError, "name (#{name.inspect}) must be sensible"
end