Class: Mixlib::Install::ArtifactInfo
- Inherits:
-
Object
- Object
- Mixlib::Install::ArtifactInfo
- Defined in:
- lib/mixlib/install/artifact_info.rb
Instance Attribute Summary collapse
-
#architecture ⇒ Object
readonly
Returns the value of attribute architecture.
-
#md5 ⇒ Object
readonly
Returns the value of attribute md5.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#platform_version ⇒ Object
readonly
Returns the value of attribute platform_version.
-
#sha1 ⇒ Object
readonly
Returns the value of attribute sha1.
-
#sha256 ⇒ Object
readonly
Returns the value of attribute sha256.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(data) ⇒ Object
-
#initialize(data) ⇒ ArtifactInfo
constructor
A new instance of ArtifactInfo.
- #to_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ ArtifactInfo
Returns a new instance of ArtifactInfo.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mixlib/install/artifact_info.rb', line 32 def initialize(data) @url = data[:url] @md5 = data[:md5] @sha256 = data[:sha256] @sha1 = data[:sha1] @version = data[:version] @platform = data[:platform] @platform_version = data[:platform_version] @architecture = data[:architecture] end |
Instance Attribute Details
#architecture ⇒ Object (readonly)
Returns the value of attribute architecture.
30 31 32 |
# File 'lib/mixlib/install/artifact_info.rb', line 30 def architecture @architecture end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
23 24 25 |
# File 'lib/mixlib/install/artifact_info.rb', line 23 def md5 @md5 end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
28 29 30 |
# File 'lib/mixlib/install/artifact_info.rb', line 28 def platform @platform end |
#platform_version ⇒ Object (readonly)
Returns the value of attribute platform_version.
29 30 31 |
# File 'lib/mixlib/install/artifact_info.rb', line 29 def platform_version @platform_version end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
25 26 27 |
# File 'lib/mixlib/install/artifact_info.rb', line 25 def sha1 @sha1 end |
#sha256 ⇒ Object (readonly)
Returns the value of attribute sha256.
24 25 26 |
# File 'lib/mixlib/install/artifact_info.rb', line 24 def sha256 @sha256 end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
22 23 24 |
# File 'lib/mixlib/install/artifact_info.rb', line 22 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
26 27 28 |
# File 'lib/mixlib/install/artifact_info.rb', line 26 def version @version end |
Class Method Details
.from_json(json, platform_info) ⇒ Object
43 44 45 |
# File 'lib/mixlib/install/artifact_info.rb', line 43 def self.from_json(json, platform_info) ArtifactInfo.new(JSON.parse(json, symbolize_names: true).merge(platform_info)) end |
.from_metadata_map(json) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mixlib/install/artifact_info.rb', line 47 def self.(json) artifacts = [] JSON.parse(json, symbolize_names: true).each do |p, p_data| p_data.each do |pv, pv_data| pv_data.each do |m, | artifacts << ArtifactInfo.new(.merge( platform: p, platform_version: pv, architecture: m )) end end end artifacts end |
Instance Method Details
#clone_with(data) ⇒ Object
78 79 80 |
# File 'lib/mixlib/install/artifact_info.rb', line 78 def clone_with(data) ArtifactInfo.new(self.to_hash.merge(data)) end |
#to_hash ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mixlib/install/artifact_info.rb', line 65 def to_hash { url: url, md5: md5, sha256: sha256, sha1: sha1, version: version, platform: platform, platform_version: platform_version, architecture: architecture, } end |