class Rascal::Docker::Volume::Named

Public Class Methods

new(name, container_path) click to toggle source
# File lib/rascal/docker/volume.rb, line 9
def initialize(name, container_path)
  @prefixed_name = "#{NAME_PREFIX}#{name}"
  @container_path = container_path
end

Public Instance Methods

clean() click to toggle source
# File lib/rascal/docker/volume.rb, line 18
def clean
  if exists?
    say "Removing volume #{@prefixed_name}"
    Docker.interface.run(
      'volume',
      'rm',
      @prefixed_name,
    )
  end
end
exists?() click to toggle source
# File lib/rascal/docker/volume.rb, line 29
def exists?
  Docker.interface.run(
    'volume',
    'ls',
    '--quiet',
    '--filter', "name=^#{@prefixed_name}$",
    output: :id,
  )
end
to_param() click to toggle source
# File lib/rascal/docker/volume.rb, line 14
def to_param
  "#{@prefixed_name}:#{@container_path}"
end