aws-record 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-record/record/attribute.rb +16 -2
- data/lib/aws-record/record/item_data.rb +1 -0
- data/lib/aws-record/record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00556892b995d898a18d635efe0ed54b68eef8aa
|
4
|
+
data.tar.gz: 3b4e23507a6b8807f6858724d2b5f506bbe8d52c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5412fe360df00866112c349095353dc5222f3768677883d2d878a9951f556f914a81d64a22cef8cb2989e6953200c03bf19130bea4063aa3ef3b02d46643ab6
|
7
|
+
data.tar.gz: 7fdc9438de9bf7b5d0f69d028c9630efc3710b83a3dcce92db33c099d7a6a0de4b963c1e5150792e5897ee13335e35d019f5f1897339e4115bb66b9f100b6d85
|
@@ -21,7 +21,7 @@ module Aws
|
|
21
21
|
# within the model class and item instances.
|
22
22
|
class Attribute
|
23
23
|
|
24
|
-
attr_reader :name, :database_name, :dynamodb_type
|
24
|
+
attr_reader :name, :database_name, :dynamodb_type
|
25
25
|
|
26
26
|
# @param [Symbol] name Name of the attribute. It should be a name that is
|
27
27
|
# safe to use as a method.
|
@@ -53,7 +53,7 @@ module Aws
|
|
53
53
|
@marshaler = options[:marshaler] || DefaultMarshaler
|
54
54
|
@persist_nil = options[:persist_nil]
|
55
55
|
dv = options[:default_value]
|
56
|
-
@
|
56
|
+
@default_value_or_lambda = type_cast(dv) unless dv.nil?
|
57
57
|
end
|
58
58
|
|
59
59
|
# Attempts to type cast a raw value into the attribute's type. This call
|
@@ -90,6 +90,20 @@ module Aws
|
|
90
90
|
dynamodb_item[@database_name]
|
91
91
|
end
|
92
92
|
|
93
|
+
# @api private
|
94
|
+
def default_value
|
95
|
+
if @default_value_or_lambda.respond_to?(:call)
|
96
|
+
@default_value_or_lambda.call
|
97
|
+
else
|
98
|
+
_deep_copy(@default_value_or_lambda)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
def _deep_copy(obj)
|
104
|
+
Marshal.load(Marshal.dump(obj))
|
105
|
+
end
|
106
|
+
|
93
107
|
end
|
94
108
|
|
95
109
|
# This is an identity marshaler, which performs no changes for type casting
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-resources
|