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.



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

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.



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

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)


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

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

#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.



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

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