Class: DepSelector::PackageVersion
- Inherits:
-
Object
- Object
- DepSelector::PackageVersion
- Defined in:
- lib/dep_selector/package_version.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#package ⇒ Object
Returns the value of attribute package.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #eql?(o) ⇒ Boolean (also: #==)
- #generate_gecode_wrapper_constraints ⇒ Object
- #hash ⇒ Object
-
#initialize(package, version) ⇒ PackageVersion
constructor
A new instance of PackageVersion.
- #to_hash ⇒ Object
- #to_s(incl_densely_packed_versions = false) ⇒ Object
Constructor Details
#initialize(package, version) ⇒ PackageVersion
Returns a new instance of PackageVersion.
24 25 26 27 28 |
# File 'lib/dep_selector/package_version.rb', line 24 def initialize(package, version) @package = package @version = version @dependencies = [] end |
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies.
22 23 24 |
# File 'lib/dep_selector/package_version.rb', line 22 def dependencies @dependencies end |
#package ⇒ Object
Returns the value of attribute package.
22 23 24 |
# File 'lib/dep_selector/package_version.rb', line 22 def package @package end |
#version ⇒ Object
Returns the value of attribute version.
22 23 24 |
# File 'lib/dep_selector/package_version.rb', line 22 def version @version end |
Instance Method Details
#eql?(o) ⇒ Boolean Also known as: ==
55 56 57 58 59 60 |
# File 'lib/dep_selector/package_version.rb', line 55 def eql?(o) o.class == self.class && package == o.package && version == o.version && dependencies == o.dependencies end |
#generate_gecode_wrapper_constraints ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/dep_selector/package_version.rb', line 30 def generate_gecode_wrapper_constraints pkg_densely_packed_version = package.densely_packed_versions.index(version) dependencies.each do |dep| dep_pkg_range = dep.package.densely_packed_versions[dep.constraint] package.dependency_graph.gecode_wrapper.add_version_constraint(package.gecode_package_id, pkg_densely_packed_version, dep.package.gecode_package_id, dep_pkg_range.min, dep_pkg_range.max) end end |
#hash ⇒ Object
49 50 51 52 53 |
# File 'lib/dep_selector/package_version.rb', line 49 def hash # Didn't put any thought or research into this, probably can be # done better to_s.hash end |
#to_hash ⇒ Object
63 64 65 |
# File 'lib/dep_selector/package_version.rb', line 63 def to_hash { :package_name => package.name, :version => version } end |
#to_s(incl_densely_packed_versions = false) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/dep_selector/package_version.rb', line 39 def to_s(incl_densely_packed_versions = false) components = [] components << "#{version}" if incl_densely_packed_versions components << " (#{package.densely_packed_versions.index(version)})" end components << " -> [#{dependencies.map{|d|d.to_s(incl_densely_packed_versions)}.join(', ')}]" components.join end |