Class: DepSelector::Dependency
- Inherits:
-
Object
- Object
- DepSelector::Dependency
- Defined in:
- lib/dep_selector/dependency.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #eql?(o) ⇒ Boolean
-
#initialize(package, constraint = nil) ⇒ Dependency
constructor
A new instance of Dependency.
- #to_s(incl_densely_packed_versions = false) ⇒ Object
Constructor Details
#initialize(package, constraint = nil) ⇒ Dependency
Returns a new instance of Dependency.
26 27 28 29 |
# File 'lib/dep_selector/dependency.rb', line 26 def initialize(package, constraint=nil) @package = package @constraint = constraint || VersionConstraint.new end |
Instance Attribute Details
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
24 25 26 |
# File 'lib/dep_selector/dependency.rb', line 24 def constraint @constraint end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
24 25 26 |
# File 'lib/dep_selector/dependency.rb', line 24 def package @package end |
Instance Method Details
#==(o) ⇒ Object
36 37 38 39 |
# File 'lib/dep_selector/dependency.rb', line 36 def ==(o) o.respond_to?(:package) && package == o.package && o.respond_to?(:constraint) && constraint == o.constraint end |
#eql?(o) ⇒ Boolean
41 42 43 |
# File 'lib/dep_selector/dependency.rb', line 41 def eql?(o) self.class == o.class && self == o end |
#to_s(incl_densely_packed_versions = false) ⇒ Object
31 32 33 34 |
# File 'lib/dep_selector/dependency.rb', line 31 def to_s(incl_densely_packed_versions = false) range = package.densely_packed_versions[constraint] "(#{package.name} #{constraint.to_s}#{incl_densely_packed_versions ? " (#{range})" : ''})" end |