Class: Eien::Renderers::DeploymentRenderer
- Defined in:
- lib/eien/renderers/deployment_renderer.rb
Instance Attribute Summary collapse
-
#deployment ⇒ Object
readonly
Returns the value of attribute deployment.
Instance Method Summary collapse
-
#initialize(deployment) ⇒ DeploymentRenderer
constructor
A new instance of DeploymentRenderer.
- #render ⇒ Object
Methods included from Helpers::TimeHelpers
Constructor Details
#initialize(deployment) ⇒ DeploymentRenderer
Returns a new instance of DeploymentRenderer.
8 9 10 11 |
# File 'lib/eien/renderers/deployment_renderer.rb', line 8 def initialize(deployment) @deployment = deployment super() end |
Instance Attribute Details
#deployment ⇒ Object (readonly)
Returns the value of attribute deployment.
6 7 8 |
# File 'lib/eien/renderers/deployment_renderer.rb', line 6 def deployment @deployment end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eien/renderers/deployment_renderer.rb', line 13 def render status = deployment.status = status.conditions.map do |condition| condition_update_time_ago = summarize_age(Time.parse(condition.lastTransitionTime)) "#{colorize_condition_type(condition.type)}\n#{condition.}\n#{condition_update_time_ago} ago\n" end.join("\n") rows = [ ["name", ColorizedString.new(name).light_magenta], ["", ""], ["created", "#{summarize_age(created_at)} ago"], ["", ""], ["replicas", [ "#{status.replicas} desired", "#{status.updatedReplicas} updated", "#{status.readyReplicas} ready", "#{status.availableReplicas} available", ].join("\n"),], ["", ""], ["condition", ], ] TTY::Table.new(rows).render(:unicode, multiline: true, padding: [0, 1]) end |