Class: KuberKit::Core::Service
Constant Summary collapse
- AttributeNotSet =
Class.new(KuberKit::Error)
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#deployer_strategy ⇒ Object
readonly
Returns the value of attribute deployer_strategy.
-
#generator_strategy ⇒ Object
readonly
Returns the value of attribute generator_strategy.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#initializers ⇒ Object
readonly
Returns the value of attribute initializers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
Instance Method Summary collapse
- #attribute(attribute_name, default: nil) ⇒ Object
-
#initialize(name:, initializers:, template_name:, tags:, images:, attributes:, deployer_strategy:, generator_strategy:) ⇒ Service
constructor
A new instance of Service.
- #uri ⇒ Object
Constructor Details
#initialize(name:, initializers:, template_name:, tags:, images:, attributes:, deployer_strategy:, generator_strategy:) ⇒ Service
Returns a new instance of Service.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kuber_kit/core/service.rb', line 17 def initialize(name:, initializers:, template_name:, tags:, images:, attributes:, deployer_strategy:, generator_strategy:) @name = name @initializers = initializers @template_name = template_name = @images = images @attributes = attributes @deployer_strategy = deployer_strategy @generator_strategy = generator_strategy end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def attributes @attributes end |
#deployer_strategy ⇒ Object (readonly)
Returns the value of attribute deployer_strategy.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def deployer_strategy @deployer_strategy end |
#generator_strategy ⇒ Object (readonly)
Returns the value of attribute generator_strategy.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def generator_strategy @generator_strategy end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def images @images end |
#initializers ⇒ Object (readonly)
Returns the value of attribute initializers.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def initializers @initializers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def name @name end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
4 5 6 |
# File 'lib/kuber_kit/core/service.rb', line 4 def template_name @template_name end |
Instance Method Details
#attribute(attribute_name, default: nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kuber_kit/core/service.rb', line 32 def attribute(attribute_name, default: nil) if !attributes.has_key?(attribute_name.to_sym) && default.nil? raise AttributeNotSet, "attribute #{attribute_name} was not set" end if !attributes.has_key?(attribute_name.to_sym) && !default.nil? return default end attributes[attribute_name.to_sym] end |
#uri ⇒ Object
28 29 30 |
# File 'lib/kuber_kit/core/service.rb', line 28 def uri name.to_s.gsub("_", "-") end |