Class: Mvnizer::Project
- Inherits:
-
Object
- Object
- Mvnizer::Project
- Includes:
- Erbicole
- Defined in:
- lib/mvnizer/project.rb
Overview
Class representing a project coordinates. The elements of the coordinates are read-only.
Constant Summary
Constants included from Erbicole
Instance Attribute Summary collapse
-
#artifact_id ⇒ Object
readonly
Returns the value of attribute artifact_id.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#group_id ⇒ Object
readonly
Returns the value of attribute group_id.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#==(project) ⇒ Object
Check whether the project coordinates of this project match the ones of the other project.
- #add_dependency(dependency) ⇒ Object
-
#initialize(group_id, artifact_id, version, type, dependencies = [], scope = nil) ⇒ Project
constructor
A new instance of Project.
- #package_name ⇒ Object
-
#to_s ⇒ Object
Converts project into its coordinates representation.
Methods included from Erbicole
Constructor Details
#initialize(group_id, artifact_id, version, type, dependencies = [], scope = nil) ⇒ Project
Returns a new instance of Project.
8 9 10 11 12 13 14 15 |
# File 'lib/mvnizer/project.rb', line 8 def initialize(group_id, artifact_id, version, type, dependencies = [], scope = nil) @group_id = group_id @artifact_id = artifact_id @version = version @type = type @dependencies = dependencies @scope = scope end |
Instance Attribute Details
#artifact_id ⇒ Object (readonly)
Returns the value of attribute artifact_id.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def artifact_id @artifact_id end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def dependencies @dependencies end |
#group_id ⇒ Object (readonly)
Returns the value of attribute group_id.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def group_id @group_id end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def scope @scope end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/mvnizer/project.rb', line 6 def version @version end |
Instance Method Details
#==(project) ⇒ Object
Check whether the project coordinates of this project match the ones of the other project.
23 24 25 26 27 28 |
# File 'lib/mvnizer/project.rb', line 23 def ==(project) (group_id == project.group_id \ && artifact_id == project.artifact_id \ && version == project.version \ && type == project.type) end |
#add_dependency(dependency) ⇒ Object
17 18 19 |
# File 'lib/mvnizer/project.rb', line 17 def add_dependency(dependency) @dependencies << dependency end |
#package_name ⇒ Object
30 31 32 33 34 |
# File 'lib/mvnizer/project.rb', line 30 def package_name package = artifact_id package = "#{group_id}.#{package}" unless group_id == nil package.gsub(/\-/, "") end |
#to_s ⇒ Object
Converts project into its coordinates representation.
37 38 39 |
# File 'lib/mvnizer/project.rb', line 37 def to_s "#{group_id}:#{artifact_id}:#{version}:#{type}:#{scope}" end |