Class: Cutlass::DockerDiff

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

Overview

Diffs docker images

diff = DockerDiff.new

diff.call.changed? # => false

BashResult.run("docker build .")

diff.call.changed? # => true

Defined Under Namespace

Classes: DiffValue

Instance Method Summary collapse

Constructor Details

#initialize(before_ids: nil, get_image_ids_proc: -> { Docker::Image.all.map(&:id) }) ⇒ DockerDiff

Returns a new instance of DockerDiff.



14
15
16
17
# File 'lib/cutlass/docker_diff.rb', line 14

def initialize(before_ids: nil, get_image_ids_proc: -> { Docker::Image.all.map(&:id) })
  @before_ids = before_ids || get_image_ids_proc.call
  @get_image_ids_proc = get_image_ids_proc
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/cutlass/docker_diff.rb', line 19

def call
  DiffValue.new(
    before_ids: @before_ids,
    now_ids: @get_image_ids_proc.call
  )
end