Class: Gitlab::Ci::Badge::Pipeline::Status
- Defined in:
- lib/gitlab/ci/badge/pipeline/status.rb
Overview
Pipeline status badge
Instance Attribute Summary collapse
-
#customization ⇒ Object
readonly
Returns the value of attribute customization.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Instance Method Summary collapse
- #entity ⇒ Object
-
#initialize(project, ref, opts: {}) ⇒ Status
constructor
A new instance of Status.
- #metadata ⇒ Object
- #status ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(project, ref, opts: {}) ⇒ Status
Returns a new instance of Status.
12 13 14 15 16 17 18 19 20 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 12 def initialize(project, ref, opts: {}) @project = project @ref = ref @ignore_skipped = Gitlab::Utils.to_boolean(opts[:ignore_skipped], default: false) @customization = { key_width: opts[:key_width].to_i, key_text: opts[:key_text] } end |
Instance Attribute Details
#customization ⇒ Object (readonly)
Returns the value of attribute customization.
10 11 12 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 10 def customization @customization end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 10 def project @project end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
10 11 12 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 10 def ref @ref end |
Instance Method Details
#entity ⇒ Object
22 23 24 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 22 def entity 'pipeline' end |
#metadata ⇒ Object
32 33 34 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 32 def ||= Pipeline::Metadata.new(self) end |
#status ⇒ Object
26 27 28 29 30 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 26 def status pipelines = @project.ci_pipelines.for_ref(@ref).order_id_desc pipelines = pipelines.without_statuses([:skipped]) if @ignore_skipped pipelines.pick(:status) || 'unknown' end |
#template ⇒ Object
36 37 38 |
# File 'lib/gitlab/ci/badge/pipeline/status.rb', line 36 def template @template ||= Pipeline::Template.new(self) end |