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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d38051cf48cd11c7a0dac98fcf9b9428e41d3d13
4
- data.tar.gz: bb3df7327933a280a85f5c01214844e65c521c8b
3
+ metadata.gz: ab7ec0ce7942ae65adf02210e960a9d2a9dad65c
4
+ data.tar.gz: 23704b711a3aa737ef79b72fe18883e6fe191290
5
5
  SHA512:
6
- metadata.gz: 1722be5b26ed320e782858b4842eb69aa24e29add54f019575e46fff97ff1a556c922de52390df2a5d6b859db2d6077d833742b852fedbaf938c5c15cfab3899
7
- data.tar.gz: 9657f0d36b07e2b2d7ec4a036984dc3305f6121ee57648ac970da2b801e3ff37ffa7c5c98078fa937053619fdc81a96a71ad020090050bd4e7f9c2d09b038b38
6
+ metadata.gz: daa6b4a93f93fc71e58309f321bbdf45a7e7220454ec6da2ee11995f7325385932132421e1d8221575f011e7a15db426d66e6abaa8fe0f4cb0970e4e06f9a9be
7
+ data.tar.gz: 088418b2f09bf3035a46d622c9b070c4759985c7aa40bb4a6d6a01e0ae0cc40735b30d9734957c8f6eb97215115b1d0f7e662c1bbd0b84fdc308675ad5630808
@@ -7,7 +7,7 @@ module OceanDynamo
7
7
  [:created_at, :datetime],
8
8
  [:updated_at, :datetime],
9
9
  [:lock_version, :integer, default: 0]
10
- ].freeze
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 = nil
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
 
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson