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.



21
22
23
24
25
# File 'lib/aws-record/record/model_attributes.rb', line 21

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.



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

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.



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

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.



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

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.



54
55
56
# File 'lib/aws-record/record/model_attributes.rb', line 54

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)


50
51
52
# File 'lib/aws-record/record/model_attributes.rb', line 50

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.



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

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.



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

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.



46
47
48
# File 'lib/aws-record/record/model_attributes.rb', line 46

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