ocean-dynamo 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ocean-dynamo/dynamo.rb +6 -9
- data/lib/ocean-dynamo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7ec0ce7942ae65adf02210e960a9d2a9dad65c
|
4
|
+
data.tar.gz: 23704b711a3aa737ef79b72fe18883e6fe191290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daa6b4a93f93fc71e58309f321bbdf45a7e7220454ec6da2ee11995f7325385932132421e1d8221575f011e7a15db426d66e6abaa8fe0f4cb0970e4e06f9a9be
|
7
|
+
data.tar.gz: 088418b2f09bf3035a46d622c9b070c4759985c7aa40bb4a6d6a01e0ae0cc40735b30d9734957c8f6eb97215115b1d0f7e662c1bbd0b84fdc308675ad5630808
|
data/lib/ocean-dynamo/dynamo.rb
CHANGED
@@ -7,7 +7,7 @@ module OceanDynamo
|
|
7
7
|
[:created_at, :datetime],
|
8
8
|
[:updated_at, :datetime],
|
9
9
|
[:lock_version, :integer, default: 0]
|
10
|
-
]
|
10
|
+
]
|
11
11
|
|
12
12
|
class DynamoError < StandardError; end
|
13
13
|
|
@@ -68,14 +68,17 @@ module OceanDynamo
|
|
68
68
|
|
69
69
|
def self.set_table_name(name)
|
70
70
|
self.table_name = name
|
71
|
+
true
|
71
72
|
end
|
72
73
|
|
73
74
|
def self.set_table_name_prefix(prefix)
|
74
75
|
self.table_name_prefix = prefix
|
76
|
+
true
|
75
77
|
end
|
76
78
|
|
77
79
|
def self.set_table_name_suffix(suffix)
|
78
80
|
self.table_name_suffix = suffix
|
81
|
+
true
|
79
82
|
end
|
80
83
|
|
81
84
|
|
@@ -96,15 +99,13 @@ module OceanDynamo
|
|
96
99
|
self.dynamo_client = nil
|
97
100
|
self.dynamo_table = nil
|
98
101
|
self.dynamo_items = nil
|
99
|
-
self.table_name =
|
102
|
+
self.table_name = compute_table_name
|
100
103
|
self.table_name_prefix = nil
|
101
104
|
self.table_name_suffix = nil
|
102
105
|
self.fields = HashWithIndifferentAccess.new
|
103
106
|
self.table_hash_key = hash_key
|
104
107
|
self.table_range_key = range_key
|
105
108
|
DEFAULT_FIELDS.each { |k, name, **pairs| field k, name, **pairs }
|
106
|
-
# Find a better place to do the following initialisation:
|
107
|
-
set_table_name compute_table_name unless self.table_name
|
108
109
|
nil
|
109
110
|
end
|
110
111
|
|
@@ -269,16 +270,12 @@ module OceanDynamo
|
|
269
270
|
self.class.class_eval "def #{name}?; read_attribute('#{name}'); end"
|
270
271
|
end
|
271
272
|
end
|
272
|
-
|
273
273
|
@dynamo_item = nil
|
274
274
|
@destroyed = false
|
275
275
|
@new_record = true
|
276
276
|
raise NoPrimaryKeyDeclared unless table_hash_key
|
277
277
|
end
|
278
|
-
|
279
|
-
if attrs
|
280
|
-
attrs.delete_if { |k, v| !fields.has_key?(k) }
|
281
|
-
end
|
278
|
+
attrs && attrs.delete_if { |k, v| !fields.has_key?(k) }
|
282
279
|
super(attrs)
|
283
280
|
end
|
284
281
|
|
data/lib/ocean-dynamo/version.rb
CHANGED