Class: Eien::Renderers::ServiceRenderer
- Defined in:
- lib/eien/renderers/service_renderer.rb
Instance Attribute Summary collapse
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(service) ⇒ ServiceRenderer
constructor
A new instance of ServiceRenderer.
- #render ⇒ Object
Methods included from Helpers::TimeHelpers
Constructor Details
#initialize(service) ⇒ ServiceRenderer
Returns a new instance of ServiceRenderer.
8 9 10 11 |
# File 'lib/eien/renderers/service_renderer.rb', line 8 def initialize(service) @service = service super() end |
Instance Attribute Details
#service ⇒ Object (readonly)
Returns the value of attribute service.
6 7 8 |
# File 'lib/eien/renderers/service_renderer.rb', line 6 def service @service end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/eien/renderers/service_renderer.rb', line 13 def render = service.spec.ports.each_with_object([]) do |port, lines| lines << "#{port.nodePort} -> #{port.port}/#{port.name} -> #{port.targetPort}" end.join("\n") rows = [ ["name", ColorizedString.new(name).light_magenta], ["", ""], ["created", "#{summarize_age(created_at)} ago"], ["", ""], ["cluster IP", service.spec.clusterIP], ["", ""], ["ports", ], ["", ""], ["external IP", external_ip_status(service)], ] TTY::Table.new(rows).render(:unicode, multiline: true, padding: [0, 1]) end |