Module: Omnizip::Models::AttributeApply

Included in:
AlgorithmMetadata, CompressionOptions, ParallelOptions
Defined in:
lib/omnizip/models/attribute_apply.rb

Overview

Shared #apply for lutaml-model Serializables: set every declared attribute present in the hash. Unknown and String keys are ignored (String keys so to_hash output needs .symbolize_keys first — .from_hash handles the round trip).

Instance Method Summary collapse

Instance Method Details

#apply(attributes) ⇒ self

Parameters:

  • attributes (Hash{Symbol=>Object})

Returns:

  • (self)


32
33
34
35
36
37
# File 'lib/omnizip/models/attribute_apply.rb', line 32

def apply(attributes)
  self.class.attributes.each_key do |name|
    public_send("#{name}=", attributes[name]) if attributes.key?(name)
  end
  self
end