Class: Aws::Record::ModelAttributes Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-record/record/model_attributes.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class) ⇒ ModelAttributes

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ModelAttributes.



10
11
12
13
14
# File 'lib/aws-record/record/model_attributes.rb', line 10

def initialize(model_class)
  @model_class = model_class
  @attributes = {}
  @storage_attributes = {}
end

Instance Attribute Details

#attributesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/aws-record/record/model_attributes.rb', line 8

def attributes
  @attributes
end

#storage_attributesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/aws-record/record/model_attributes.rb', line 8

def storage_attributes
  @storage_attributes
end

Instance Method Details

#attribute_for(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/aws-record/record/model_attributes.rb', line 31

def attribute_for(name)
  @attributes[name]
end

#db_to_attribute_name(storage_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
# File 'lib/aws-record/record/model_attributes.rb', line 43

def db_to_attribute_name(storage_name)
  @storage_attributes[storage_name]
end

#present?(name) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


39
40
41
# File 'lib/aws-record/record/model_attributes.rb', line 39

def present?(name)
  attribute_for(name) ? true : false
end

#register_attribute(name, marshaler, opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
# File 'lib/aws-record/record/model_attributes.rb', line 16

def register_attribute(name, marshaler, opts)
  attribute = Attribute.new(name, opts.merge(marshaler: marshaler))
  _new_attr_validation(name, attribute)
  @attributes[name] = attribute
  @storage_attributes[attribute.database_name] = name
  attribute
end

#register_superclass_attribute(name, attribute) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
# File 'lib/aws-record/record/model_attributes.rb', line 24

def register_superclass_attribute (name, attribute)
  _new_attr_validation(name, attribute)
  @attributes[name] = attribute.dup
  @storage_attributes[attribute.database_name] = name
  attribute
end

#storage_name_for(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
# File 'lib/aws-record/record/model_attributes.rb', line 35

def storage_name_for(name)
  attribute_for(name).database_name
end