Class: Coordinates
- Inherits:
-
Object
- Object
- Coordinates
- Defined in:
- lib/jlauncher/common.rb
Instance Method Summary collapse
-
#initialize(coords) ⇒ Coordinates
constructor
A new instance of Coordinates.
- #local_ivy_path ⇒ Object
- #local_maven_path ⇒ Object
- #relative_url ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(coords) ⇒ Coordinates
Returns a new instance of Coordinates.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jlauncher/common.rb', line 3 def initialize(coords) if coords.is_a? Hash @group_id = coords['groupId'] @artifact_id = coords['artifactId'] @version = coords['version'] return end if coords.is_a? String components = coords.split(":") @group_id = components[0] @artifact_id = components[1] @version = components[2] return end raise "Could not parse coordinates " + coords.to_s end |
Instance Method Details
#local_ivy_path ⇒ Object
31 32 33 |
# File 'lib/jlauncher/common.rb', line 31 def local_ivy_path File.join(@group_id, @artifact_id, "jars", @artifact_id + "-" + @version + ".jar") end |
#local_maven_path ⇒ Object
27 28 29 |
# File 'lib/jlauncher/common.rb', line 27 def local_maven_path File.join(@group_id.split("."), @artifact_id, @version, @artifact_id + "-" + @version + ".jar") end |
#relative_url ⇒ Object
35 36 37 38 |
# File 'lib/jlauncher/common.rb', line 35 def relative_url @group_id.split(".").join("/") + "/" + @artifact_id + "/" + @version + "/" + @artifact_id + "-" + @version + ".jar" end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/jlauncher/common.rb', line 23 def to_s @group_id + ":" + @artifact_id + ":" + @version end |