Module: AWS::Record
- Defined in:
- lib/aws/record.rb,
lib/aws/record/model.rb,
lib/aws/record/scope.rb,
lib/aws/record/errors.rb,
lib/aws/record/naming.rb,
lib/aws/record/validator.rb,
lib/aws/record/attributes.rb,
lib/aws/record/conversion.rb,
lib/aws/record/exceptions.rb,
lib/aws/record/hash_model.rb,
lib/aws/record/model/scope.rb,
lib/aws/record/validations.rb,
lib/aws/record/abstract_base.rb,
lib/aws/record/dirty_tracking.rb,
lib/aws/record/hash_model/scope.rb,
lib/aws/record/model/attributes.rb,
lib/aws/record/validators/block.rb,
lib/aws/record/validators/count.rb,
lib/aws/record/validators/format.rb,
lib/aws/record/validators/length.rb,
lib/aws/record/validators/method.rb,
lib/aws/record/validators/presence.rb,
lib/aws/record/model/finder_methods.rb,
lib/aws/record/validators/exclusion.rb,
lib/aws/record/validators/inclusion.rb,
lib/aws/record/hash_model/attributes.rb,
lib/aws/record/validators/acceptance.rb,
lib/aws/record/validators/confirmation.rb,
lib/aws/record/validators/numericality.rb,
lib/aws/record/hash_model/finder_methods.rb
Overview
AWS::Record is an ORM built on top of AWS services.
Defined Under Namespace
Modules: AbstractBase, Attributes, Conversion, DirtyTracking, Naming, Validations Classes: AcceptanceValidator, BlockValidator, ConfirmationValidator, CountValidator, EmptyRecordError, Errors, ExclusionValidator, FormatValidator, HashModel, InclusionValidator, InvalidRecordError, LengthValidator, MethodValidator, Model, NumericalityValidator, PresenceValidator, RecordNotFound, Scope, UndefinedAttributeError, Validator
Constant Summary collapse
- Base =
for backwards compatability with the old AWS::Record::Base
Model
Class Method Summary collapse
-
.as_array(value) ⇒ Array
A utility method for casting values into an array.
-
.as_set(value) ⇒ Set
A utility method for casting values into .
-
.domain_prefix ⇒ String?
The string that is prepended to all domain names.
-
.domain_prefix=(prefix) ⇒ Object
Sets a prefix to be applied to all SimpleDB domains associated with AWS::Record::Base classes.
-
.table_prefix ⇒ String?
The string that is prepended to all table names.
-
.table_prefix=(prefix) ⇒ Object
Sets a prefix to be applied to all DynamoDB tables associated with HashModel and ListModel classes.
Class Method Details
.as_array(value) ⇒ Array
A utility method for casting values into an array.
-
nil is returned as an empty array, []
-
Arrays are returned unmodified
-
Everything else is returned as the sole element of an array
91 92 93 94 95 96 97 98 |
# File 'lib/aws/record.rb', line 91 def self.as_array value case value when nil then [] when Set then value.to_a when Array then value else [value] end end |
.as_set(value) ⇒ Set
A utility method for casting values into
-
Sets are returned unmodified
-
everything else is passed through #as_array and then into a new Set
108 109 110 111 112 113 |
# File 'lib/aws/record.rb', line 108 def self.as_set value case value when Set then value else Set.new(as_array(value)) end end |
.domain_prefix ⇒ String?
Returns The string that is prepended to all domain names.
51 52 53 |
# File 'lib/aws/record.rb', line 51 def self.domain_prefix @domain_prefix end |
.domain_prefix=(prefix) ⇒ Object
Sets a prefix to be applied to all SimpleDB domains associated with AWS::Record::Base classes.
AWS::Record.domain_prefix = 'production_'
class Product < AWS::Record::Base
set_shard_name 'products'
end
p = Product.new
p.shard #=> 'products'
p.save # the product is persisted to the 'production-products' domain
46 47 48 |
# File 'lib/aws/record.rb', line 46 def self.domain_prefix= prefix @domain_prefix = prefix end |
.table_prefix ⇒ String?
Returns The string that is prepended to all table names.
78 79 80 |
# File 'lib/aws/record.rb', line 78 def self.table_prefix @table_prefix end |
.table_prefix=(prefix) ⇒ Object
Sets a prefix to be applied to all DynamoDB tables associated with HashModel and ListModel classes.
AWS::Record.table_prefix = 'production_'
class Product < AWS::Record::HashModel
set_shard_name 'products'
end
p = Product.new
p.shard #=> 'products'
p.save # the product is persisted to the 'production-products' table
73 74 75 |
# File 'lib/aws/record.rb', line 73 def self.table_prefix= prefix @table_prefix = prefix end |