Class: Gitlab::Ci::Badge::Release::LatestRelease
- Defined in:
- lib/gitlab/ci/badge/release/latest_release.rb
Instance Attribute Summary collapse
-
#customization ⇒ Object
readonly
Returns the value of attribute customization.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
Instance Method Summary collapse
- #entity ⇒ Object
-
#initialize(project, current_user, opts: {}) ⇒ LatestRelease
constructor
A new instance of LatestRelease.
- #metadata ⇒ Object
- #tag ⇒ Object
- #template ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(project, current_user, opts: {}) ⇒ LatestRelease
Returns a new instance of LatestRelease.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 9 def initialize(project, current_user, opts: {}) @project = project @customization = { key_width: opts[:key_width] ? opts[:key_width].to_i : nil, key_text: opts[:key_text], value_width: opts[:value_width] ? opts[:value_width].to_i : nil } # In the future, we should support `order_by=semver` for showing the # latest release based on Semantic Versioning. @release = ::ReleasesFinder.new( project, current_user, order_by_for_latest: opts[:order_by], latest: true).execute.first end |
Instance Attribute Details
#customization ⇒ Object (readonly)
Returns the value of attribute customization.
7 8 9 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 7 def customization @customization end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 7 def project @project end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
7 8 9 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 7 def release @release end |
Instance Method Details
#entity ⇒ Object
26 27 28 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 26 def entity 'Latest Release' end |
#metadata ⇒ Object
34 35 36 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 34 def @metadata ||= Release::Metadata.new(self) end |
#tag ⇒ Object
30 31 32 |
# File 'lib/gitlab/ci/badge/release/latest_release.rb', line 30 def tag @release&.tag end |