Class: Cutlass::DockerDiff::DiffValue

Inherits:
Object
  • Object
show all
Defined in:
lib/cutlass/docker_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_ids:, now_ids:) ⇒ DiffValue

Returns a new instance of DiffValue.



29
30
31
# File 'lib/cutlass/docker_diff.rb', line 29

def initialize(before_ids:, now_ids:)
  @diff_ids = now_ids - before_ids
end

Instance Attribute Details

#diff_idsObject (readonly)

Returns the value of attribute diff_ids.



27
28
29
# File 'lib/cutlass/docker_diff.rb', line 27

def diff_ids
  @diff_ids
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/cutlass/docker_diff.rb', line 33

def changed?
  @diff_ids.any?
end

#leaked_imagesObject



41
42
43
44
45
# File 'lib/cutlass/docker_diff.rb', line 41

def leaked_images
  diff_ids.map do |id|
    Docker::Image.get(id)
  end
end

#same?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/cutlass/docker_diff.rb', line 37

def same?
  !changed?
end

#to_sObject



47
48
49
50
51
# File 'lib/cutlass/docker_diff.rb', line 47

def to_s
  leaked_images.map do |image|
    "  tags: #{image.info["RepoTags"]}, id: #{image.id}"
  end.join($/)
end