class Composer::Package::Link
Represents a link between two packages, represented by their names
Attributes
constraint[R]
source[R]
target[R]
Public Class Methods
new(source, target, constraint = nil, description = 'relates to', pretty_constraint = nil)
click to toggle source
Creates a new package link. @param string source @param string target @param LinkConstraintInterface constraint Constraint applying to the target of this link @param string description Used to create a descriptive string representation @param string prettyConstraint
# File lib/composer/package/link.rb, line 26 def initialize(source, target, constraint = nil, description = 'relates to', pretty_constraint = nil) @source = source.downcase @target = target.downcase @constraint = constraint @description = description @pretty_constraint = pretty_constraint end
Public Instance Methods
pretty_constraint()
click to toggle source
# File lib/composer/package/link.rb, line 34 def pretty_constraint unless @pretty_constraint raise UnexpectedValueError, "Link #{self} has been misconfigured and had no pretty constraint given." end @pretty_constraint end
pretty_string(source_package)
click to toggle source
# File lib/composer/package/link.rb, line 41 def pretty_string(source_package) "#{source_package.pretty_string} #{@description} #{@target} #{@constraint.pretty_string}" end
to_s()
click to toggle source
# File lib/composer/package/link.rb, line 45 def to_s "#{@source} #{@description} #{@target} (#{@constraint})" end