Class: Naether::Notation
- Inherits:
-
Object
- Object
- Naether::Notation
- Defined in:
- lib/naether/notation.rb
Overview
Helper for handling Maven notations, supports notations:
* artifactId:groupId:version
* artifactId:groupId:type:version
* artifactId:groupId:type:classifier:version
Constant Summary
- PATTERN =
Regexp.compile( '^(.+?):(.+?):(.+?)(:(.+?)(:(.+))?)?$' )
Instance Attribute Summary (collapse)
-
- (Object) artifact
readonly
Returns the value of attribute artifact.
-
- (Object) classifier
readonly
Returns the value of attribute classifier.
-
- (Object) group
readonly
Returns the value of attribute group.
-
- (Object) type
readonly
Returns the value of attribute type.
-
- (Object) version
readonly
Returns the value of attribute version.
Instance Method Summary (collapse)
-
- (Notation) initialize(notation)
constructor
A new instance of Notation.
- - (Object) to_notation
Constructor Details
- (Notation) initialize(notation)
Returns a new instance of Notation
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/naether/notation.rb', line 14 def initialize(notation) if notation =~ PATTERN @group = Regexp.last_match(1) @artifact = Regexp.last_match(2) # artifactId:groupId:type:classifier:version if Regexp.last_match(7) @type = Regexp.last_match(3) @classifier = Regexp.last_match(5) @version = Regexp.last_match(7) # artifactId:groupId:type:version elsif Regexp.last_match(5) @type = Regexp.last_match(3) @version = Regexp.last_match(5) # artifactId:groupId:version - else @type = 'jar' @version = Regexp.last_match(3) end end def to_notation "#{group}:#{artifact}:#{type}#{":#{classifier}" if classifier}:#{version}" end end |
Instance Attribute Details
- (Object) artifact (readonly)
Returns the value of attribute artifact
10 11 12 |
# File 'lib/naether/notation.rb', line 10 def artifact @artifact end |
- (Object) classifier (readonly)
Returns the value of attribute classifier
10 11 12 |
# File 'lib/naether/notation.rb', line 10 def classifier @classifier end |
- (Object) group (readonly)
Returns the value of attribute group
10 11 12 |
# File 'lib/naether/notation.rb', line 10 def group @group end |
- (Object) type (readonly)
Returns the value of attribute type
10 11 12 |
# File 'lib/naether/notation.rb', line 10 def type @type end |
- (Object) version (readonly)
Returns the value of attribute version
10 11 12 |
# File 'lib/naether/notation.rb', line 10 def version @version end |
Instance Method Details
- (Object) to_notation
37 38 39 |
# File 'lib/naether/notation.rb', line 37 def to_notation "#{group}:#{artifact}:#{type}#{":#{classifier}" if classifier}:#{version}" end |