Class: Lyp::DependencySpec

Inherits:
Object
  • Object
show all
Defined in:
lib/lyp/resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clauseObject (readonly)

Returns the value of attribute clause.



3
4
5
# File 'lib/lyp/resolver.rb', line 3

def clause
  @clause
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/lyp/resolver.rb', line 3

def location
  @location
end

#versionsObject (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

Returns:

  • (Boolean)


15
16
17
# File 'lib/lyp/resolver.rb', line 15

def eql?(o)
  @clause.eql?(o.clause) && @versions.eql?(o.versions)
end

#hashObject



19
20
21
# File 'lib/lyp/resolver.rb', line 19

def hash
  {clause: clause, versions: versions}.hash
end