module Aws::Record::Attributes

def self.included(sub_class)

def self.included(sub_class)
  sub_class.extend(ClassMethods)
  model_attributes = ModelAttributes.new(self)
  sub_class.instance_variable_set('@attributes', model_attributes)
  sub_class.instance_variable_set('@keys', KeyAttributes.new(model_attributes))
  inherit_attributes(sub_class) if Aws::Record.extends_record?(sub_class)
end

def self.inherit_attributes(klass)

def self.inherit_attributes(klass)
  superclass_attributes = klass.superclass.instance_variable_get('@attributes')
  superclass_attributes.attributes.each do |name, attribute|
    subclass_attributes = klass.instance_variable_get('@attributes')
    subclass_attributes.register_superclass_attribute(name, attribute)
  end
  superclass_keys = klass.superclass.instance_variable_get('@keys')
  subclass_keys = klass.instance_variable_get('@keys')
  subclass_keys.hash_key = superclass_keys.hash_key if superclass_keys.hash_key
  subclass_keys.range_key = superclass_keys.range_key if superclass_keys.range_key
end

def attribute_names

Returns:
  • (Array) - List of attribute names.
def attribute_names
  self.class.attribute_names
end

def initialize(attr_values = {})

Returns:
  • (Aws::Record) - An item instance for your model.

Parameters:
  • attr_values (Hash) -- Attribute symbol/value pairs for any initial

Other tags:
    Example: Child model overrides the hash key -
    Example: Child model inheriting from Parent model -
    Example: Usage Example -
def initialize(attr_values = {})
  opts = {
    track_mutations: self.class.mutation_tracking_enabled?
  }
  @data = ItemData.new(self.class.attributes, opts)
  attr_values.each do |attr_name, attr_value|
    send("#{attr_name}=", attr_value)
  end
end

def to_h

Returns:
  • (Hash) - Map of attribute names to raw values.
def to_h
  @data.hash_copy
end