Class: Sarif::VersionControlDetails
- Inherits:
-
Object
- Object
- Sarif::VersionControlDetails
- Defined in:
- lib/sarif/version_control_details.rb
Overview
Specifies the information necessary to retrieve a desired revision from a version control system.
Instance Attribute Summary collapse
-
#as_of_time_utc ⇒ Object
Returns the value of attribute as_of_time_utc.
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#mapped_to ⇒ Object
Returns the value of attribute mapped_to.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#repository_uri ⇒ Object
Returns the value of attribute repository_uri.
-
#revision_id ⇒ Object
Returns the value of attribute revision_id.
-
#revision_tag ⇒ Object
Returns the value of attribute revision_tag.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(repository_uri:, revision_id: nil, branch: nil, revision_tag: nil, as_of_time_utc: nil, mapped_to: nil, properties: nil) ⇒ VersionControlDetails
constructor
A new instance of VersionControlDetails.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(repository_uri:, revision_id: nil, branch: nil, revision_tag: nil, as_of_time_utc: nil, mapped_to: nil, properties: nil) ⇒ VersionControlDetails
Returns a new instance of VersionControlDetails.
8 9 10 11 12 13 14 15 16 |
# File 'lib/sarif/version_control_details.rb', line 8 def initialize(repository_uri:, revision_id: nil, branch: nil, revision_tag: nil, as_of_time_utc: nil, mapped_to: nil, properties: nil) @repository_uri = repository_uri @revision_id = revision_id @branch = branch @revision_tag = revision_tag @as_of_time_utc = as_of_time_utc @mapped_to = mapped_to @properties = properties end |
Instance Attribute Details
#as_of_time_utc ⇒ Object
Returns the value of attribute as_of_time_utc.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def as_of_time_utc @as_of_time_utc end |
#branch ⇒ Object
Returns the value of attribute branch.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def branch @branch end |
#mapped_to ⇒ Object
Returns the value of attribute mapped_to.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def mapped_to @mapped_to end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def properties @properties end |
#repository_uri ⇒ Object
Returns the value of attribute repository_uri.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def repository_uri @repository_uri end |
#revision_id ⇒ Object
Returns the value of attribute revision_id.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def revision_id @revision_id end |
#revision_tag ⇒ Object
Returns the value of attribute revision_tag.
6 7 8 |
# File 'lib/sarif/version_control_details.rb', line 6 def revision_tag @revision_tag end |
Class Method Details
.from_hash(h) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sarif/version_control_details.rb', line 34 def self.from_hash(h) return nil if h.nil? new( repository_uri: h["repositoryUri"], revision_id: h["revisionId"], branch: h["branch"], revision_tag: h["revisionTag"], as_of_time_utc: h["asOfTimeUtc"], mapped_to: ArtifactLocation.from_hash(h["mappedTo"]), properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
47 48 49 50 |
# File 'lib/sarif/version_control_details.rb', line 47 def ==(other) return false unless other.is_a?(VersionControlDetails) @repository_uri == other.repository_uri && @revision_id == other.revision_id && @branch == other.branch && @revision_tag == other.revision_tag && @as_of_time_utc == other.as_of_time_utc && @mapped_to == other.mapped_to && @properties == other.properties end |
#hash ⇒ Object
54 55 56 |
# File 'lib/sarif/version_control_details.rb', line 54 def hash [@repository_uri, @revision_id, @branch, @revision_tag, @as_of_time_utc, @mapped_to, @properties].hash end |
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sarif/version_control_details.rb', line 18 def to_h h = {} h["repositoryUri"] = @repository_uri h["revisionId"] = @revision_id unless @revision_id.nil? h["branch"] = @branch unless @branch.nil? h["revisionTag"] = @revision_tag unless @revision_tag.nil? h["asOfTimeUtc"] = @as_of_time_utc unless @as_of_time_utc.nil? h["mappedTo"] = @mapped_to&.to_h unless @mapped_to.nil? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
30 31 32 |
# File 'lib/sarif/version_control_details.rb', line 30 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |