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.



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

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.



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

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.



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

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.



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

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.



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

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)


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

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.



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

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.



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

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.



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

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