Class: LockJar::Domain::Pom

Inherits:
Artifact show all
Defined in:
lib/lock_jar/domain/artifact.rb

Instance Attribute Summary collapse

Attributes inherited from Artifact

#type

Instance Method Summary collapse

Methods inherited from Artifact

#resolvable?

Constructor Details

#initialize(pom_path, pom_scopes = %w(compile runtime)) ⇒ Pom

Returns a new instance of Pom.



81
82
83
84
85
# File 'lib/lock_jar/domain/artifact.rb', line 81

def initialize(pom_path, pom_scopes = %w(compile runtime))
  @type = 'pom'
  @path = pom_path
  @scopes = pom_scopes
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



79
80
81
# File 'lib/lock_jar/domain/artifact.rb', line 79

def path
  @path
end

#scopesObject (readonly)

Returns the value of attribute scopes.



79
80
81
# File 'lib/lock_jar/domain/artifact.rb', line 79

def scopes
  @scopes
end

Instance Method Details

#<=>(other) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/lock_jar/domain/artifact.rb', line 103

def <=>(other)
  if other.is_a? Pom
    return Set.new(scopes) <=> Set.new(other.scopes) if to_urn == other.to_urn

    to_urn <=> other.to_urn
  else
    super
  end
end

#==(other) ⇒ Object



99
100
101
# File 'lib/lock_jar/domain/artifact.rb', line 99

def ==(other)
  self.<=>(other) == 0
end

#notationsObject



95
96
97
# File 'lib/lock_jar/domain/artifact.rb', line 95

def notations
  LockJar::Maven.dependencies(path, scopes)
end

#to_depObject



91
92
93
# File 'lib/lock_jar/domain/artifact.rb', line 91

def to_dep
  { path => scopes }
end

#to_urnObject



87
88
89
# File 'lib/lock_jar/domain/artifact.rb', line 87

def to_urn
  "pom:#{path}"
end