Class: DTK::State::ComponentDef::AttributeTypeInfo
- Inherits:
-
Object
- Object
- DTK::State::ComponentDef::AttributeTypeInfo
- Defined in:
- lib/state/component_def/attribute_type_info.rb
Instance Attribute Summary collapse
-
#dynamic ⇒ Object
readonly
Returns the value of attribute dynamic.
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#temporal ⇒ Object
readonly
Returns the value of attribute temporal.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, params) ⇒ AttributeTypeInfo
constructor
A new instance of AttributeTypeInfo.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, params) ⇒ AttributeTypeInfo
Returns a new instance of AttributeTypeInfo.
7 8 9 10 11 12 13 14 |
# File 'lib/state/component_def/attribute_type_info.rb', line 7 def initialize(name, params) @name = name.to_s @type = params[:type] @required = params[:required] || false @dynamic = params[:dynamic] || false @temporal = params[:temporal] || false @encrypted = params[:encrypted] || false end |
Instance Attribute Details
#dynamic ⇒ Object (readonly)
Returns the value of attribute dynamic.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def dynamic @dynamic end |
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def encrypted @encrypted end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def required @required end |
#temporal ⇒ Object (readonly)
Returns the value of attribute temporal.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def temporal @temporal end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/state/component_def/attribute_type_info.rb', line 5 def type @type end |
Class Method Details
.create_from_kube_hash(kube_attributes) ⇒ Object
16 17 18 19 20 |
# File 'lib/state/component_def/attribute_type_info.rb', line 16 def self.create_from_kube_hash(kube_attributes) kube_attributes.to_hash.map do |attribute_name, attribute_content| AttributeTypeInfo.new(attribute_name, attribute_content) end end |
Instance Method Details
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/state/component_def/attribute_type_info.rb', line 22 def to_hash type_info = {} type_info.merge!(name: @name) if @name type_info.merge!(type: @type) if @type type_info.merge!(required: @required) if @required type_info.merge!(dynamic: @dynamic) if @dynamic type_info.merge!(temporal: @temporal) if @temporal type_info.merge!(encrypted: @encrypted) if @encrypted type_info end |