Class: Lyp::DependencySpec
- Inherits:
-
Object
- Object
- Lyp::DependencySpec
- Defined in:
- lib/lyp/resolver.rb
Instance Attribute Summary collapse
-
#clause ⇒ Object
readonly
Returns the value of attribute clause.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
- #add_version(version, leaf) ⇒ Object
- #eql?(o) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(clause, versions, location = nil) ⇒ DependencySpec
constructor
A new instance of DependencySpec.
Constructor Details
#initialize(clause, versions, location = nil) ⇒ DependencySpec
Returns a new instance of DependencySpec.
5 6 7 8 9 |
# File 'lib/lyp/resolver.rb', line 5 def initialize(clause, versions, location = nil) @clause = clause @versions = versions.inject({}) {|m, kv| m[kv[0].to_s] = kv[1]; m} @location = location end |
Instance Attribute Details
#clause ⇒ Object (readonly)
Returns the value of attribute clause.
3 4 5 |
# File 'lib/lyp/resolver.rb', line 3 def clause @clause end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/lyp/resolver.rb', line 3 def location @location end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
3 4 5 |
# File 'lib/lyp/resolver.rb', line 3 def versions @versions end |
Instance Method Details
#add_version(version, leaf) ⇒ Object
11 12 13 |
# File 'lib/lyp/resolver.rb', line 11 def add_version(version, leaf) @versions[version.to_s] = leaf end |
#eql?(o) ⇒ Boolean
15 16 17 |
# File 'lib/lyp/resolver.rb', line 15 def eql?(o) @clause.eql?(o.clause) && @versions.eql?(o.versions) end |
#hash ⇒ Object
19 20 21 |
# File 'lib/lyp/resolver.rb', line 19 def hash {clause: clause, versions: versions}.hash end |