Class: Dependabot::GitTagDetails
- Inherits:
-
Hash
- Object
- Hash
- Dependabot::GitTagDetails
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/dependabot/git_tag_details.rb
Overview
A git tag (or ref) resolved to a version, as produced by GitCommitChecker's local_tag_for_* / local_ref_for_* methods, e.g.:
{
tag: "v1.2.0",
version: Dependabot::Version.new("1.2.0"),
commit_sha: "a1b2c3...",
tag_sha: "d4e5f6..." # nil for lightweight tags
}
Distinct from Dependabot::GitTagWithDetail, which carries a tag name and release date for cooldown handling.
Subclasses Hash so it is a drop-in replacement at the many call sites that read entries with [:key] / fetch, while exposing typed readers for the well-known keys. Instances compare equal (Hash#==) to plain hashes with the same content, so existing comparisons and API payloads are unaffected.
Constant Summary collapse
- K =
type_member { { fixed: Symbol } }
- V =
type_member { { fixed: Object } }
- Elem =
type_member { { fixed: [Symbol, Object] } }
Instance Method Summary collapse
- #commit_sha ⇒ Object
-
#initialize(tag:, version: nil, commit_sha: nil, tag_sha: nil) ⇒ GitTagDetails
constructor
A new instance of GitTagDetails.
- #tag ⇒ Object
- #tag_sha ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(tag:, version: nil, commit_sha: nil, tag_sha: nil) ⇒ GitTagDetails
Returns a new instance of GitTagDetails.
40 41 42 43 44 45 46 |
# File 'lib/dependabot/git_tag_details.rb', line 40 def initialize(tag:, version: nil, commit_sha: nil, tag_sha: nil) super() self[:tag] = tag self[:version] = version self[:commit_sha] = commit_sha self[:tag_sha] = tag_sha end |
Instance Method Details
#commit_sha ⇒ Object
62 63 64 |
# File 'lib/dependabot/git_tag_details.rb', line 62 def commit_sha T.cast(self[:commit_sha], T.nilable(String)) end |
#tag ⇒ Object
50 51 52 |
# File 'lib/dependabot/git_tag_details.rb', line 50 def tag T.cast(self[:tag], String) end |
#tag_sha ⇒ Object
68 69 70 |
# File 'lib/dependabot/git_tag_details.rb', line 68 def tag_sha T.cast(self[:tag_sha], T.nilable(String)) end |
#version ⇒ Object
56 57 58 |
# File 'lib/dependabot/git_tag_details.rb', line 56 def version T.cast(self[:version], T.nilable(Gem::Version)) end |