Class: GitlabJanitor::ImageCleaner::Model
Instance Attribute Summary collapse
#model
Instance Method Summary
collapse
#method_missing, #respond_to?, #respond_to_missing?
Constructor Details
#initialize(model, name, store) ⇒ Model
Returns a new instance of Model.
11
12
13
14
15
16
17
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 11
def initialize(model, name, store)
super(model)
@store = store
@name = name
info['_Age'] = (Time.now - Time.at(loaded_at)).round(0)
end
|
Instance Attribute Details
#store ⇒ Object
Returns the value of attribute store.
9
10
11
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 9
def store
@store
end
|
Instance Method Details
#age ⇒ Object
27
28
29
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 27
def age
info['_Age']
end
|
#age_text ⇒ Object
31
32
33
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 31
def age_text
Fugit::Duration.parse(age).deflate.to_plain_s
end
|
#id ⇒ Object
35
36
37
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 35
def id
info['id']
end
|
#loaded_at ⇒ Object
19
20
21
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 19
def loaded_at
store.image(self)[:loaded_at]
end
|
#name ⇒ Object
23
24
25
|
# File 'lib/gitlab_janitor/image_cleaner.rb', line 23
def name
@name || id
end
|