Class: Gitlab::Ci::Badge::Pipeline::Template
- Defined in:
- lib/gitlab/ci/badge/pipeline/template.rb
Overview
Class that represents a pipeline badge template.
Template object will be passed to badge.svg.erb template.
Constant Summary collapse
- STATUS_RENAME =
{ 'success' => 'passed' }.freeze
- STATUS_COLOR =
{ success: '#4c1', failed: '#e05d44', running: '#dfb317', pending: '#dfb317', preparing: '#a7a7a7', canceled: '#9f9f9f', skipped: '#9f9f9f', unknown: '#9f9f9f' }.freeze
Constants inherited from Template
Template::DEFAULT_KEY_WIDTH, Template::MAX_KEY_TEXT_SIZE, Template::MAX_KEY_WIDTH
Instance Method Summary collapse
-
#initialize(badge) ⇒ Template
constructor
A new instance of Template.
- #value_color ⇒ Object
- #value_text ⇒ Object
- #value_width ⇒ Object
Methods inherited from Template
#key_color, #key_text, #key_text_anchor, #key_width, #value_text_anchor, #width
Constructor Details
#initialize(badge) ⇒ Template
Returns a new instance of Template.
24 25 26 27 |
# File 'lib/gitlab/ci/badge/pipeline/template.rb', line 24 def initialize(badge) @status = badge.status super end |
Instance Method Details
#value_color ⇒ Object
37 38 39 |
# File 'lib/gitlab/ci/badge/pipeline/template.rb', line 37 def value_color STATUS_COLOR[@status.to_sym] || STATUS_COLOR[:unknown] end |
#value_text ⇒ Object
29 30 31 |
# File 'lib/gitlab/ci/badge/pipeline/template.rb', line 29 def value_text STATUS_RENAME[@status.to_s] || @status.to_s end |
#value_width ⇒ Object
33 34 35 |
# File 'lib/gitlab/ci/badge/pipeline/template.rb', line 33 def value_width 54 end |