Class: Kuby::Docker::Packages::ManagedPackage
- Inherits:
-
Object
- Object
- Kuby::Docker::Packages::ManagedPackage
- Defined in:
- lib/kuby/docker/packages/managed_package.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
T::Sig::WithoutRuntime.sig { returns(Symbol) }.
-
#names_per_distro ⇒ Object
readonly
T::Sig::WithoutRuntime.sig { returns(T::Hash[Symbol, String]) }.
Instance Method Summary collapse
-
#initialize(name, names_per_distro) ⇒ ManagedPackage
constructor
T::Sig::WithoutRuntime.sig { params( name: Symbol, names_per_distro: T::Hash[Symbol, String] ) .void }.
-
#managed? ⇒ Boolean
T::Sig::WithoutRuntime.sig { returns(T::Boolean) }.
-
#package_name_for(distro) ⇒ Object
T::Sig::WithoutRuntime.sig { params(distro: Symbol).returns(String) }.
-
#with_version(ver) ⇒ Object
T::Sig::WithoutRuntime.sig { params(ver: String).returns(T.self_type) }.
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
#name ⇒ Object (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_distro ⇒ Object (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) }
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 |