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 and treat them as T::Hash[Symbol, T.untyped], 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 =
The values are heterogeneous (strings and a version object), so this bridge class is necessarily untyped at the Hash level; the typed readers below are the migration path. rubocop:disable Sorbet/ForbidTUntyped
type_member { { fixed: Symbol } }
- V =
type_member { { fixed: T.untyped } }
- Elem =
type_member { { fixed: [Symbol, T.untyped] } }
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.
46 47 48 49 50 51 52 |
# File 'lib/dependabot/git_tag_details.rb', line 46 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
68 69 70 |
# File 'lib/dependabot/git_tag_details.rb', line 68 def commit_sha self[:commit_sha] end |
#tag ⇒ Object
56 57 58 |
# File 'lib/dependabot/git_tag_details.rb', line 56 def tag self[:tag] end |
#tag_sha ⇒ Object
74 75 76 |
# File 'lib/dependabot/git_tag_details.rb', line 74 def tag_sha self[:tag_sha] end |
#version ⇒ Object
62 63 64 |
# File 'lib/dependabot/git_tag_details.rb', line 62 def version self[:version] end |