Class: GitlabJanitor::ContainerCleaner::Model

Inherits:
BaseCleaner::Model show all
Defined in:
lib/gitlab_janitor/container_cleaner.rb

Instance Attribute Summary

Attributes inherited from BaseCleaner::Model

#model

Instance Method Summary collapse

Methods inherited from BaseCleaner::Model

#method_missing, #respond_to?, #respond_to_missing?

Constructor Details

#initialize(model) ⇒ Model

Returns a new instance of Model.



6
7
8
9
10
# File 'lib/gitlab_janitor/container_cleaner.rb', line 6

def initialize(model)
  super(model)

  info['_Age'] = (Time.now - Time.at(created_at)).round(0)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GitlabJanitor::BaseCleaner::Model

Instance Method Details

#ageObject



20
21
22
# File 'lib/gitlab_janitor/container_cleaner.rb', line 20

def age
  info['_Age']
end

#age_textObject



24
25
26
# File 'lib/gitlab_janitor/container_cleaner.rb', line 24

def age_text
  Fugit::Duration.parse(age).deflate.to_plain_s
end

#created_atObject



12
13
14
# File 'lib/gitlab_janitor/container_cleaner.rb', line 12

def created_at
  info['Created']
end

#nameObject



16
17
18
# File 'lib/gitlab_janitor/container_cleaner.rb', line 16

def name
  @name ||= info['Names'].first.sub(%r{^/}, '')
end