class Librarian::Dependency::Requirement
Constants
- COMPATS_TABLE
Attributes
backing[RW]
Public Class Methods
new(*args)
click to toggle source
# File lib/librarian/dependency.rb, line 7 def initialize(*args) args = initialize_normalize_args(args) self.backing = Gem::Requirement.create(*args) end
Public Instance Methods
==(other)
click to toggle source
# File lib/librarian/dependency.rb, line 21 def ==(other) to_gem_requirement == other.to_gem_requirement end
consistent_with?(other)
click to toggle source
# File lib/librarian/dependency.rb, line 64 def consistent_with?(other) sgreq, ogreq = to_gem_requirement, other.to_gem_requirement sreqs, oreqs = sgreq.requirements, ogreq.requirements sreqs.all? do |sreq| oreqs.all? do |oreq| compatible?(sreq, oreq) end end end
inconsistent_with?(other)
click to toggle source
# File lib/librarian/dependency.rb, line 74 def inconsistent_with?(other) !consistent_with?(other) end
inspect()
click to toggle source
# File lib/librarian/dependency.rb, line 29 def inspect "#<#{self.class} #{to_s}>" end
satisfied_by?(version)
click to toggle source
# File lib/librarian/dependency.rb, line 17 def satisfied_by?(version) to_gem_requirement.satisfied_by?(version.to_gem_version) end
to_gem_requirement()
click to toggle source
# File lib/librarian/dependency.rb, line 13 def to_gem_requirement backing end
to_s()
click to toggle source
# File lib/librarian/dependency.rb, line 25 def to_s to_gem_requirement.to_s end
Private Instance Methods
compatible?(a, b)
click to toggle source
# File lib/librarian/dependency.rb, line 91 def compatible?(a, b) a, b = b, a unless COMPATS_TABLE.include?([a.first, b.first]) r = COMPATS_TABLE[[a.first, b.first]] r = r.call(a.last, b.last) if r.respond_to?(:call) r end
initialize_normalize_args(args)
click to toggle source
# File lib/librarian/dependency.rb, line 84 def initialize_normalize_args(args) args.map do |arg| arg = arg.backing if self.class === arg arg end end