Class: Semaph::Model::Promotion
- Inherits:
-
Object
- Object
- Semaph::Model::Promotion
- Defined in:
- lib/semaph/model/promotion.rb
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(pipeline, raw) ⇒ Promotion
constructor
A new instance of Promotion.
- #status_icon ⇒ Object
Constructor Details
#initialize(pipeline, raw) ⇒ Promotion
Returns a new instance of Promotion.
8 9 10 11 12 13 14 |
# File 'lib/semaph/model/promotion.rb', line 8 def initialize(pipeline, raw) @pipeline = pipeline @raw = raw @name = raw["name"] @status = raw["status"] @triggered_at = Time.at(raw["triggered_at"]["seconds"]) end |
Instance Attribute Details
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
6 7 8 |
# File 'lib/semaph/model/promotion.rb', line 6 def pipeline @pipeline end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/semaph/model/promotion.rb', line 6 def raw @raw end |
Instance Method Details
#description ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/semaph/model/promotion.rb', line 16 def description [ status_icon, Semaph::Formatting.time(@triggered_at), @name, ].join(" ") end |
#status_icon ⇒ Object
24 25 26 27 28 |
# File 'lib/semaph/model/promotion.rb', line 24 def status_icon return "🟢" if @status == "passed" "🔴" end |