Class: Kuby::Docker::Packages::ManagedPackage

Inherits:
Object
  • Object
show all
Defined in:
lib/kuby/docker/packages/managed_package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, names_per_distro) ⇒ ManagedPackage

T::Sig::WithoutRuntime.sig

params(
  name: Symbol,
  names_per_distro: T::Hash[Symbol, String]
)
.void



22
23
24
25
# File 'lib/kuby/docker/packages/managed_package.rb', line 22

def initialize(name, names_per_distro)
  @name = name
  @names_per_distro = names_per_distro
end

Instance Attribute Details

#nameObject (readonly)

T::Sig::WithoutRuntime.sig { returns(Symbol) }



10
11
12
# File 'lib/kuby/docker/packages/managed_package.rb', line 10

def name
  @name
end

#names_per_distroObject (readonly)

T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }



13
14
15
# File 'lib/kuby/docker/packages/managed_package.rb', line 13

def names_per_distro
  @names_per_distro
end

Instance Method Details

#managed?Boolean

T::Sig::WithoutRuntime.sig { returns(T::Boolean) }

Returns:

  • (Boolean)


41
42
43
# File 'lib/kuby/docker/packages/managed_package.rb', line 41

def managed?
  true
end

#package_name_for(distro) ⇒ Object

T::Sig::WithoutRuntime.sig { params(distro: Symbol).returns(String) }



28
29
30
31
32
33
# File 'lib/kuby/docker/packages/managed_package.rb', line 28

def package_name_for(distro)
  names_per_distro.fetch(distro) do
    raise UnsupportedDistroError, "Couldn't install #{name} "\
      "because #{distro} is an unsupported distro"
  end
end

#with_version(ver) ⇒ Object

T::Sig::WithoutRuntime.sig { params(ver: String).returns(T.self_type) }



36
37
38
# File 'lib/kuby/docker/packages/managed_package.rb', line 36

def with_version(ver)
  self
end