Class: KuberKit::Core::ServiceDefinition
- Defined in:
- lib/kuber_kit/core/service_definition.rb
Instance Attribute Summary collapse
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
Instance Method Summary collapse
-
#initialize(service_name) ⇒ ServiceDefinition
constructor
A new instance of ServiceDefinition.
- #tags(*value, &block) ⇒ Object
- #template(value = nil, &block) ⇒ Object
- #to_service_attrs ⇒ Object
Constructor Details
#initialize(service_name) ⇒ ServiceDefinition
Returns a new instance of ServiceDefinition.
5 6 7 |
# File 'lib/kuber_kit/core/service_definition.rb', line 5 def initialize(service_name) @service_name = service_name.to_sym end |
Instance Attribute Details
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
2 3 4 |
# File 'lib/kuber_kit/core/service_definition.rb', line 2 def service_name @service_name end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
2 3 4 |
# File 'lib/kuber_kit/core/service_definition.rb', line 2 def template_name @template_name end |
Instance Method Details
#tags(*value, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/kuber_kit/core/service_definition.rb', line 23 def (*value, &block) @tags = block_given? ? block : Array(value).flatten self end |
#template(value = nil, &block) ⇒ Object
17 18 19 20 21 |
# File 'lib/kuber_kit/core/service_definition.rb', line 17 def template(value = nil, &block) @template_name = block_given? ? block : value self end |
#to_service_attrs ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/kuber_kit/core/service_definition.rb', line 9 def to_service_attrs OpenStruct.new( name: @service_name, template_name: get_value(@template_name), tags: Array(get_value(@tags)).map(&:to_sym) ) end |