lib/aws-record/record/attributes.rb
# Define an attribute for your model, providing your own attribute type.
#
# @param [Symbol] name Name of this attribute.  It should be a name that
#   is safe to use as a method.
# @param [Marshaler] marshaler The marshaler for this attribute. So long
#   as you provide a marshaler which implements +#type_cast+ and
#   +#serialize+ that consume raw values as expected, you can bring your
#   own marshaler type. Convenience methods will provide this for you.
# @param [Hash] opts
# @option opts [String] :database_attribute_name Optional attribute
#   used to specify a different name for database persistence than the
#   `name` parameter. Must be unique (you can't have overlap between
#   database attribute names and the names of other attributes).
# @option opts [String] :dynamodb_type Generally used for keys and
#   index attributes, one of "S", "N", "B", "BOOL", "SS", "NS", "BS",
#   "M", "L". Optional if this attribute will never be used for a key or
#   secondary index, but most convenience methods for setting attributes
#   will provide this.
# @option opts [Boolean] :persist_nil Optional attribute used to
#   indicate whether nil values should be persisted. If true, explicitly
#   set nil values will be saved to DynamoDB as a "null" type. If false,
#   nil values will be ignored and not persisted. By default, is false.
# @option opts [Object] :default_value Optional attribute used to
#   define a "default value" to be used if the attribute's value on an
#   item is nil or not set at persistence time.
# @option opts [Boolean] :hash_key Set to true if this attribute is
#   the hash key for the table.
# @option opts [Boolean] :range_key Set to true if this attribute is
#   the range key for the table.
Define an attribute for your model, providing your own attribute type.
Define an attribute for your model providing your own attribute type .
def attr(name, marshaler, opts = {})
          @attributes.register_attribute(name, marshaler, opts)
          _define_attr_methods(name)
          _key_attributes(name, opts)
        end
def attr ( name , marshaler , opts = { } ) @attributes . register_attribute ( name , marshaler , opts ) _define_attr_methods ( name ) _key_attributes ( name , opts ) end
Define an attribute for your model, providing your own attribute type.
Define an attribute for your model providing your own attribute type .
name
<not_specific>
marshaler
<not_specific>
opts
:range_key Set to true if this attribute is the range key for the table.
: range_key Set to true if this attribute is the range key for the table .
<not_specific>
None