Class: Docker::Stack::Container
- Inherits:
-
Object
- Object
- Docker::Stack::Container
- Includes:
- ActionView::Helpers::DateHelper
- Defined in:
- lib/docker/stack/container.rb
Instance Method Summary collapse
-
#initialize(id) ⇒ Container
constructor
A new instance of Container.
- #service ⇒ Object
- #started ⇒ Object
- #status ⇒ Object
- #to_h ⇒ Object
- #uptime_in_words ⇒ Object
Constructor Details
Instance Method Details
#service ⇒ Object
15 16 17 |
# File 'lib/docker/stack/container.rb', line 15 def service info('Config', 'Labels', 'com.docker.compose.service') end |
#started ⇒ Object
23 24 25 26 27 |
# File 'lib/docker/stack/container.rb', line 23 def started value = info('State', 'StartedAt') return value if value == 'unknown' Time.parse(value).utc end |
#status ⇒ Object
19 20 21 |
# File 'lib/docker/stack/container.rb', line 19 def status info('State', 'Health', 'Status') end |
#to_h ⇒ Object
34 35 36 |
# File 'lib/docker/stack/container.rb', line 34 def to_h { id: @id, service: service, status: status, started: started, running: uptime_in_words } end |
#uptime_in_words ⇒ Object
29 30 31 32 |
# File 'lib/docker/stack/container.rb', line 29 def uptime_in_words return started if started == 'unknown' time_ago_in_words(started) end |