aws-record 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -19
  3. data/VERSION +1 -1
  4. data/lib/aws-record/record/attribute.rb +4 -2
  5. data/lib/aws-record/record/batch_read.rb +8 -13
  6. data/lib/aws-record/record/batch_write.rb +2 -1
  7. data/lib/aws-record/record/buildable_search.rb +15 -20
  8. data/lib/aws-record/record/client_configuration.rb +7 -7
  9. data/lib/aws-record/record/dirty_tracking.rb +3 -11
  10. data/lib/aws-record/record/errors.rb +11 -1
  11. data/lib/aws-record/record/item_collection.rb +5 -5
  12. data/lib/aws-record/record/item_data.rb +10 -11
  13. data/lib/aws-record/record/item_operations.rb +98 -70
  14. data/lib/aws-record/record/marshalers/boolean_marshaler.rb +4 -4
  15. data/lib/aws-record/record/marshalers/date_marshaler.rb +1 -3
  16. data/lib/aws-record/record/marshalers/date_time_marshaler.rb +1 -3
  17. data/lib/aws-record/record/marshalers/epoch_time_marshaler.rb +2 -6
  18. data/lib/aws-record/record/marshalers/float_marshaler.rb +4 -4
  19. data/lib/aws-record/record/marshalers/integer_marshaler.rb +4 -4
  20. data/lib/aws-record/record/marshalers/list_marshaler.rb +6 -6
  21. data/lib/aws-record/record/marshalers/map_marshaler.rb +6 -6
  22. data/lib/aws-record/record/marshalers/numeric_set_marshaler.rb +7 -7
  23. data/lib/aws-record/record/marshalers/string_marshaler.rb +3 -1
  24. data/lib/aws-record/record/marshalers/string_set_marshaler.rb +6 -6
  25. data/lib/aws-record/record/marshalers/time_marshaler.rb +1 -3
  26. data/lib/aws-record/record/model_attributes.rb +14 -16
  27. data/lib/aws-record/record/query.rb +4 -4
  28. data/lib/aws-record/record/secondary_indexes.rb +22 -25
  29. data/lib/aws-record/record/table_config.rb +45 -56
  30. data/lib/aws-record/record/table_migration.rb +32 -36
  31. data/lib/aws-record/record/transactions.rb +18 -18
  32. data/lib/aws-record/record/version.rb +1 -1
  33. data/lib/aws-record/record.rb +8 -8
  34. metadata +4 -5
@@ -11,20 +11,27 @@ module Aws
11
11
  # Saves this instance of an item to Amazon DynamoDB. If this item is "new"
12
12
  # as defined by having new or altered key attributes, will attempt a
13
13
  # conditional
14
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#put_item-instance_method
14
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
15
15
  # Aws::DynamoDB::Client#put_item} call, which will not overwrite an existing
16
16
  # item. If the item only has altered non-key attributes, will perform an
17
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#update_item-instance_method
17
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
18
18
  # Aws::DynamoDB::Client#update_item} call. Uses this item instance's attributes
19
19
  # in order to build the request on your behalf.
20
20
  #
21
21
  # You can use the +:force+ option to perform a simple put/overwrite
22
22
  # without conditional validation or update logic.
23
23
  #
24
- # @param [Hash] opts
24
+ # @param [Hash] opts Options to pass through to the
25
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
26
+ # Aws::DynamoDB::Client#put_item} call or the
27
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
28
+ # Aws::DynamoDB::Client#update_item} call. +:put_item+ is used when
29
+ # +:force+ is true or when the item is new. +:update_item+ is used when
30
+ # the item is not new.
25
31
  # @option opts [Boolean] :force if true, will save as a put operation and
26
32
  # overwrite any existing item on the remote end. Otherwise, and by
27
33
  # default, will either perform a conditional put or an update call.
34
+ #
28
35
  # @raise [Aws::Record::Errors::KeyMissing] if a required key attribute
29
36
  # does not have a value within this item instance.
30
37
  # @raise [Aws::Record::Errors::ConditionalWriteFailed] if a conditional
@@ -34,30 +41,35 @@ module Aws
34
41
  # cause is dependent on the validation library you are using.
35
42
  def save!(opts = {})
36
43
  ret = save(opts)
37
- if ret
38
- ret
39
- else
40
- raise Errors::ValidationError, 'Validation hook returned false!'
41
- end
44
+ raise Errors::ValidationError, 'Validation hook returned false!' unless ret
45
+
46
+ ret
42
47
  end
43
48
 
44
49
  # Saves this instance of an item to Amazon DynamoDB. If this item is "new"
45
50
  # as defined by having new or altered key attributes, will attempt a
46
51
  # conditional
47
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#put_item-instance_method
52
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
48
53
  # Aws::DynamoDB::Client#put_item} call, which will not overwrite an
49
54
  # existing item. If the item only has altered non-key attributes, will perform an
50
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#update_item-instance_method
55
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
51
56
  # Aws::DynamoDB::Client#update_item} call. Uses this item instance's attributes
52
57
  # in order to build the request on your behalf.
53
58
  #
54
59
  # You can use the +:force+ option to perform a simple put/overwrite
55
60
  # without conditional validation or update logic.
56
61
  #
57
- # @param [Hash] opts
62
+ # @param [Hash] opts Options to pass through to the
63
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
64
+ # Aws::DynamoDB::Client#put_item} call or the
65
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
66
+ # Aws::DynamoDB::Client#update_item} call. +:put_item+ is used when
67
+ # +:force+ is true or when the item is new. +:update_item+ is used when
68
+ # the item is not new.
58
69
  # @option opts [Boolean] :force if true, will save as a put operation and
59
70
  # overwrite any existing item on the remote end. Otherwise, and by
60
71
  # default, will either perform a conditional put or an update call.
72
+ #
61
73
  # @return false if the record is invalid as defined by an attempt to call
62
74
  # +valid?+ on this item, if that method exists. Otherwise, returns client
63
75
  # call return value.
@@ -98,6 +110,7 @@ module Aws
98
110
  field = field.to_sym
99
111
  setter = "#{field}="
100
112
  raise ArgumentError, "Invalid field: #{field} for model" unless respond_to?(setter)
113
+
101
114
  public_send(setter, new_value)
102
115
  end
103
116
  end
@@ -132,12 +145,19 @@ module Aws
132
145
  # model.dirty? # => false
133
146
  #
134
147
  #
135
- # @param [Hash] new_param, contains the new parameters for the model
148
+ # @param [Hash] new_params Contains the new parameters for the model.
136
149
  #
137
- # @param [Hash] opts
150
+ # @param [Hash] opts Options to pass through to the
151
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
152
+ # Aws::DynamoDB::Client#put_item} call or the
153
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
154
+ # Aws::DynamoDB::Client#update_item} call. +:put_item+ is used when
155
+ # +:force+ is true or when the item is new. +:update_item+ is used when
156
+ # the item is not new.
138
157
  # @option opts [Boolean] :force if true, will save as a put operation and
139
158
  # overwrite any existing item on the remote end. Otherwise, and by
140
159
  # default, will either perform a conditional put or an update call.
160
+ #
141
161
  # @return false if the record is invalid as defined by an attempt to call
142
162
  # +valid?+ on this item, if that method exists. Otherwise, returns client
143
163
  # call return value.
@@ -155,12 +175,18 @@ module Aws
155
175
  # but this will be interpreted as persisting a new item to your DynamoDB
156
176
  # table
157
177
  #
158
- # @param [Hash] new_param, contains the new parameters for the model
159
- #
160
- # @param [Hash] opts
178
+ # @param [Hash] new_params Contains the new parameters for the model.
179
+ # @param [Hash] opts Options to pass through to the
180
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#put_item-instance_method
181
+ # Aws::DynamoDB::Client#put_item} call or the
182
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
183
+ # Aws::DynamoDB::Client#update_item} call. +:put_item+ is used when
184
+ # +:force+ is true or when the item is new. +:update_item+ is used when
185
+ # the item is not new.
161
186
  # @option opts [Boolean] :force if true, will save as a put operation and
162
187
  # overwrite any existing item on the remote end. Otherwise, and by
163
188
  # default, will either perform a conditional put or an update call.
189
+ #
164
190
  # @return The update mode if the update is successful
165
191
  #
166
192
  # @raise [Aws::Record::Errors::ValidationError] if any new values
@@ -172,18 +198,23 @@ module Aws
172
198
 
173
199
  # Deletes the item instance that matches the key values of this item
174
200
  # instance in Amazon DynamoDB. Uses the
175
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#delete_item-instance_method
201
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#delete_item-instance_method
176
202
  # Aws::DynamoDB::Client#delete_item} API.
177
- def delete!
178
- dynamodb_client.delete_item(
203
+ #
204
+ # @param [Hash] opts Options to pass through to the
205
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#delete_item-instance_method
206
+ # Aws::DynamoDB::Client#delete_item} call.
207
+ def delete!(opts = {})
208
+ delete_opts = {
179
209
  table_name: self.class.table_name,
180
210
  key: key_values
181
- )
211
+ }
212
+ dynamodb_client.delete_item(opts.merge(delete_opts))
182
213
  instance_variable_get('@data').destroyed = true
183
214
  end
184
215
 
185
216
  # Validates and generates the key values necessary for API operations such as the
186
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#delete_item-instance_method
217
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#delete_item-instance_method
187
218
  # Aws::DynamoDB::Client#delete_item} operation.
188
219
  def key_values
189
220
  validate_key_values
@@ -207,36 +238,35 @@ module Aws
207
238
 
208
239
  def _invalid_record?(_opts)
209
240
  if respond_to?(:valid?)
210
- if !valid?
211
- true
212
- else
213
- false
214
- end
241
+ !valid?
215
242
  else
216
243
  false
217
244
  end
218
245
  end
219
246
 
220
247
  def _perform_save(opts)
221
- force = opts[:force]
248
+ force = opts.delete(:force)
222
249
  expect_new = expect_new_item?
223
250
  if force
224
- dynamodb_client.put_item(
251
+ put_opts = {
225
252
  table_name: self.class.table_name,
226
253
  item: _build_item_for_save
227
- )
254
+ }
255
+ dynamodb_client.put_item(opts.merge(put_opts))
228
256
  elsif expect_new
229
257
  put_opts = {
230
258
  table_name: self.class.table_name,
231
259
  item: _build_item_for_save
232
260
  }.merge(prevent_overwrite_expression)
233
261
  begin
234
- dynamodb_client.put_item(put_opts)
235
- rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException
236
- raise Errors::ConditionalWriteFailed,
237
- 'Conditional #put_item call failed! Check that conditional write'\
238
- ' conditions are met, or include the :force option to clobber'\
239
- ' the remote item.'
262
+ dynamodb_client.put_item(opts.merge(put_opts))
263
+ rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException => e
264
+ raise Errors::ConditionalWriteFailed.new(
265
+ 'Conditional #put_item call failed! Check that conditional write ' \
266
+ 'conditions are met, or include the :force option to clobber ' \
267
+ 'the remote item.',
268
+ e
269
+ )
240
270
  end
241
271
  else
242
272
  update_pairs = _dirty_changes_for_update
@@ -246,20 +276,20 @@ module Aws
246
276
  )
247
277
  if update_tuple
248
278
  uex, exp_attr_names, exp_attr_values = update_tuple
249
- request_opts = {
279
+ update_opts = {
250
280
  table_name: self.class.table_name,
251
281
  key: key_values,
252
282
  update_expression: uex,
253
283
  expression_attribute_names: exp_attr_names
254
284
  }
255
- request_opts[:expression_attribute_values] = exp_attr_values unless exp_attr_values.empty?
256
- dynamodb_client.update_item(request_opts)
285
+ update_opts[:expression_attribute_values] = exp_attr_values unless exp_attr_values.empty?
257
286
  else
258
- dynamodb_client.update_item(
287
+ update_opts = {
259
288
  table_name: self.class.table_name,
260
289
  key: key_values
261
- )
290
+ }
262
291
  end
292
+ dynamodb_client.update_item(opts.merge(update_opts))
263
293
  end
264
294
  data = instance_variable_get('@data')
265
295
  data.destroyed = false
@@ -311,11 +341,10 @@ module Aws
311
341
  end
312
342
 
313
343
  def _dirty_changes_for_update
314
- ret = dirty.each_with_object({}) do |attr_name, acc|
344
+ dirty.each_with_object({}) do |attr_name, acc|
315
345
  acc[attr_name] = @data.raw_value(attr_name)
316
346
  acc
317
347
  end
318
- ret
319
348
  end
320
349
 
321
350
  module ItemOperationsClassMethods
@@ -350,9 +379,8 @@ module Aws
350
379
  key = opts.delete(:key)
351
380
  check_key = {}
352
381
  @keys.keys.each_value do |attr_sym|
353
- unless key[attr_sym]
354
- raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}"
355
- end
382
+ raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}" unless key[attr_sym]
383
+
356
384
  attr_name = attributes.storage_name_for(attr_sym)
357
385
  check_key[attr_name] = attributes.attribute_for(attr_sym)
358
386
  .serialize(key[attr_sym])
@@ -374,9 +402,8 @@ module Aws
374
402
  key = opts.delete(:key)
375
403
  request_key = {}
376
404
  @keys.keys.each_value do |attr_sym|
377
- unless key[attr_sym]
378
- raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}"
379
- end
405
+ raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}" unless key[attr_sym]
406
+
380
407
  attr_name = attributes.storage_name_for(attr_sym)
381
408
  request_key[attr_name] = attributes.attribute_for(attr_sym)
382
409
  .serialize(key[attr_sym])
@@ -468,30 +495,33 @@ module Aws
468
495
  # supports the options you are including, and avoid adding options not
469
496
  # recognized by the underlying client to avoid runtime exceptions.
470
497
  #
471
- # @param [Hash] opts Options to pass through to the DynamoDB #get_item
472
- # request. The +:key+ option is a special case where attributes are
473
- # serialized and translated for you similar to the #find method.
498
+ # @param [Hash] opts Options to pass through to the
499
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#get_item-instance_method
500
+ # Aws::DynamoDB::Client#get_item} request. The +:key+ option is a
501
+ # special case where attributes are serialized and translated for you
502
+ # similar to the #find method.
474
503
  # @option opts [Hash] :key attribute-value pairs for the key you wish to
475
504
  # search for.
505
+ #
476
506
  # @return [Aws::Record] builds and returns an instance of your model.
507
+ #
477
508
  # @raise [Aws::Record::Errors::KeyMissing] if your option parameters do
478
509
  # not include all table keys.
479
510
  def find_with_opts(opts)
480
511
  key = opts.delete(:key)
481
512
  request_key = {}
482
513
  @keys.keys.each_value do |attr_sym|
483
- unless key[attr_sym]
484
- raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}"
485
- end
514
+ raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{key}" unless key[attr_sym]
515
+
486
516
  attr_name = attributes.storage_name_for(attr_sym)
487
517
  request_key[attr_name] = attributes.attribute_for(attr_sym)
488
518
  .serialize(key[attr_sym])
489
519
  end
490
- request_opts = {
520
+ get_opts = {
491
521
  table_name: table_name,
492
522
  key: request_key
493
523
  }.merge(opts)
494
- resp = dynamodb_client.get_item(request_opts)
524
+ resp = dynamodb_client.get_item(get_opts)
495
525
  if resp.item.nil?
496
526
  nil
497
527
  else
@@ -547,7 +577,7 @@ module Aws
547
577
  # MyModel.update(id: 1, name: "First", body: "Hello!")
548
578
  #
549
579
  # Performs an
550
- # {http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#update_item-instance_method
580
+ # {http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#update_item-instance_method
551
581
  # Aws::DynamoDB::Client#update_item} call immediately on the table,
552
582
  # using the attribute key/value pairs provided.
553
583
  #
@@ -555,6 +585,7 @@ module Aws
555
585
  # wish to perform. You must include all key attributes for a valid
556
586
  # call, then you may optionally include any other attributes that you
557
587
  # wish to update.
588
+ #
558
589
  # @raise [Aws::Record::Errors::KeyMissing] if your option parameters do
559
590
  # not include all table keys.
560
591
  def update(opts)
@@ -564,21 +595,22 @@ module Aws
564
595
  raise Errors::KeyMissing, "Missing required key #{attr_sym} in #{opts}"
565
596
 
566
597
  end
598
+
567
599
  attr_name = attributes.storage_name_for(attr_sym)
568
600
  key[attr_name] = attributes.attribute_for(attr_sym).serialize(value)
569
601
  end
570
- request_opts = {
602
+ update_opts = {
571
603
  table_name: table_name,
572
604
  key: key
573
605
  }
574
606
  update_tuple = _build_update_expression(opts)
575
607
  unless update_tuple.nil?
576
608
  uex, exp_attr_names, exp_attr_values = update_tuple
577
- request_opts[:update_expression] = uex
578
- request_opts[:expression_attribute_names] = exp_attr_names
579
- request_opts[:expression_attribute_values] = exp_attr_values unless exp_attr_values.empty?
609
+ update_opts[:update_expression] = uex
610
+ update_opts[:expression_attribute_names] = exp_attr_names
611
+ update_opts[:expression_attribute_values] = exp_attr_values unless exp_attr_values.empty?
580
612
  end
581
- dynamodb_client.update_item(request_opts)
613
+ dynamodb_client.update_item(update_opts)
582
614
  end
583
615
 
584
616
  private
@@ -591,8 +623,8 @@ module Aws
591
623
  name_sub_token = 'UE_A'
592
624
  value_sub_token = 'ue_a'
593
625
  attr_value_pairs.each do |attr_sym, value|
594
- name_sub = '#' + name_sub_token
595
- value_sub = ':' + value_sub_token
626
+ name_sub = "##{name_sub_token}"
627
+ value_sub = ":#{value_sub_token}"
596
628
  name_sub_token = name_sub_token.succ
597
629
  value_sub_token = value_sub_token.succ
598
630
 
@@ -607,12 +639,8 @@ module Aws
607
639
  end
608
640
  end
609
641
  update_expressions = []
610
- unless set_expressions.empty?
611
- update_expressions << 'SET ' + set_expressions.join(', ')
612
- end
613
- unless remove_expressions.empty?
614
- update_expressions << 'REMOVE ' + remove_expressions.join(', ')
615
- end
642
+ update_expressions << ("SET #{set_expressions.join(', ')}") unless set_expressions.empty?
643
+ update_expressions << ("REMOVE #{remove_expressions.join(', ')}") unless remove_expressions.empty?
616
644
  if update_expressions.empty?
617
645
  nil
618
646
  else
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class BooleanMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- nil
13
- when ''
13
+ when nil, ''
14
14
  nil
15
15
  when false, 'false', '0', 0
16
16
  false
@@ -12,9 +12,7 @@ module Aws
12
12
 
13
13
  def type_cast(raw_value)
14
14
  case raw_value
15
- when nil
16
- nil
17
- when ''
15
+ when nil, ''
18
16
  nil
19
17
  when Date
20
18
  raw_value
@@ -36,9 +36,7 @@ module Aws
36
36
 
37
37
  def _format(raw_value)
38
38
  case raw_value
39
- when nil
40
- nil
41
- when ''
39
+ when nil, ''
42
40
  nil
43
41
  when ::DateTime
44
42
  raw_value
@@ -35,15 +35,11 @@ module Aws
35
35
 
36
36
  def _format(raw_value)
37
37
  case raw_value
38
- when nil
39
- nil
40
- when ''
38
+ when nil, ''
41
39
  nil
42
40
  when ::Time
43
41
  raw_value
44
- when Integer # timestamp
45
- ::Time.at(raw_value)
46
- when BigDecimal
42
+ when Integer, BigDecimal # timestamp
47
43
  ::Time.at(raw_value)
48
44
  else # Date, DateTime, or String
49
45
  ::Time.parse(raw_value.to_s)
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class FloatMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- nil
13
- when ''
13
+ when nil, ''
14
14
  nil
15
15
  when Float
16
16
  raw_value
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class IntegerMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- nil
13
- when ''
13
+ when nil, ''
14
14
  nil
15
15
  when Integer
16
16
  raw_value
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class ListMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- nil
13
- when ''
13
+ when nil, ''
14
14
  nil
15
15
  when Array
16
16
  raw_value
@@ -18,8 +18,8 @@ module Aws
18
18
  if raw_value.respond_to?(:to_a)
19
19
  raw_value.to_a
20
20
  else
21
- msg = "Don't know how to make #{raw_value} of type"\
22
- " #{raw_value.class} into an array!"
21
+ msg = "Don't know how to make #{raw_value} of type " \
22
+ "#{raw_value.class} into an array!"
23
23
  raise ArgumentError, msg
24
24
  end
25
25
  end
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class MapMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- nil
13
- when ''
13
+ when nil, ''
14
14
  nil
15
15
  when Hash
16
16
  raw_value
@@ -18,8 +18,8 @@ module Aws
18
18
  if raw_value.respond_to?(:to_h)
19
19
  raw_value.to_h
20
20
  else
21
- msg = "Don't know how to make #{raw_value} of type"\
22
- " #{raw_value.class} into a hash!"
21
+ msg = "Don't know how to make #{raw_value} of type " \
22
+ "#{raw_value.class} into a hash!"
23
23
  raise ArgumentError, msg
24
24
  end
25
25
  end
@@ -3,14 +3,14 @@
3
3
  module Aws
4
4
  module Record
5
5
  module Marshalers
6
- class NumericSetMarshaler
7
- def initialize(opts = {}); end
6
+ def initialize(opts = {})
7
+ # pass
8
+ end
8
9
 
10
+ class NumericSetMarshaler
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- Set.new
13
- when ''
13
+ when nil, ''
14
14
  Set.new
15
15
  when Set
16
16
  _as_numeric(raw_value)
@@ -18,8 +18,8 @@ module Aws
18
18
  if raw_value.respond_to?(:to_set)
19
19
  _as_numeric(raw_value.to_set)
20
20
  else
21
- msg = "Don't know how to make #{raw_value} of type"\
22
- " #{raw_value.class} into a Numeric Set!"
21
+ msg = "Don't know how to make #{raw_value} of type " \
22
+ "#{raw_value.class} into a Numeric Set!"
23
23
  raise ArgumentError, msg
24
24
  end
25
25
  end
@@ -4,7 +4,9 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class StringMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
@@ -4,13 +4,13 @@ module Aws
4
4
  module Record
5
5
  module Marshalers
6
6
  class StringSetMarshaler
7
- def initialize(opts = {}); end
7
+ def initialize(opts = {})
8
+ # pass
9
+ end
8
10
 
9
11
  def type_cast(raw_value)
10
12
  case raw_value
11
- when nil
12
- Set.new
13
- when ''
13
+ when nil, ''
14
14
  Set.new
15
15
  when Set
16
16
  _as_strings(raw_value)
@@ -18,8 +18,8 @@ module Aws
18
18
  if raw_value.respond_to?(:to_set)
19
19
  _as_strings(raw_value.to_set)
20
20
  else
21
- msg = "Don't know how to make #{raw_value} of type"\
22
- " #{raw_value.class} into a String Set!"
21
+ msg = "Don't know how to make #{raw_value} of type " \
22
+ "#{raw_value.class} into a String Set!"
23
23
  raise ArgumentError, msg
24
24
  end
25
25
  end
@@ -36,9 +36,7 @@ module Aws
36
36
 
37
37
  def _format(raw_value)
38
38
  case raw_value
39
- when nil
40
- nil
41
- when ''
39
+ when nil, ''
42
40
  nil
43
41
  when ::Time
44
42
  raw_value