Skip to content

Commit 7ef7a2e

Browse files
authored
chore: use SPDX license identifier (#154)
1 parent c959e65 commit 7ef7a2e

16 files changed

+48
-12
lines changed

aws-record.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
88
spec.summary = 'AWS Record library for Amazon DynamoDB'
99
spec.description = 'Provides an object mapping abstraction for Amazon DynamoDB.'
1010
spec.homepage = 'https://github.com/aws/aws-sdk-ruby-record'
11-
spec.license = 'Apache 2.0'
11+
spec.license = 'Apache-2.0'
1212

1313
spec.require_paths = ['lib']
1414
spec.files = Dir['lib/**/*.rb', 'LICENSE', 'CHANGELOG.md', 'VERSION']

features/batch/step_definitions.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
expect(expected.all? { |e| actual.include?(e) }).to be_truthy
5555
end
5656

57-
private
58-
5957
def remove_model_key(item)
6058
item.delete(:model)
6159
item

lib/aws-record/record/batch_read.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def find(klass, key = {})
3737
# See {Batch.read} for example usage.
3838
# @return [Array] an array of unordered new items
3939
def execute!
40-
operation_keys = unprocessed_keys[0..BATCH_GET_ITEM_LIMIT - 1]
40+
operation_keys = unprocessed_keys[0..(BATCH_GET_ITEM_LIMIT - 1)]
4141
@unprocessed_keys = unprocessed_keys[BATCH_GET_ITEM_LIMIT..] || []
4242

4343
operations = build_operations(operation_keys)

lib/aws-record/record/model_attributes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _validate_attr_name(name)
5959
end
6060

6161
def _check_if_reserved(name)
62-
return unless @model_class.instance_methods.include?(name)
62+
return unless @model_class.method_defined?(name)
6363

6464
raise Errors::ReservedName, "Cannot name an attribute #{name}, that would collide with an " \
6565
'existing instance method.'

lib/aws-record/record/table_config.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def migrate!
244244
# we will only alter TTL status if we have a TTL attribute defined. We
245245
# may someday support explicit TTL deletion, but we do not yet do this.
246246
return unless @ttl_attribute
247-
return if _ttl_compatibility_check
247+
return if ttl_compatibility_check?
248248

249249
client.update_time_to_live(
250250
table_name: @model_class.table_name,
@@ -268,7 +268,7 @@ def migrate!
268268
# @return [Boolean] true if remote is compatible, false otherwise.
269269
def compatible?
270270
resp = @client.describe_table(table_name: @model_class.table_name)
271-
_compatible_check(resp) && _ttl_compatibility_check
271+
_compatible_check(resp) && ttl_compatibility_check?
272272
rescue DynamoDB::Errors::ResourceNotFoundException
273273
false
274274
end
@@ -285,14 +285,14 @@ def exact_match?
285285
_keys_equal(resp) &&
286286
_ad_equal(resp) &&
287287
_gsi_equal(resp) &&
288-
_ttl_match_check
288+
ttl_match_check?
289289
rescue DynamoDB::Errors::ResourceNotFoundException
290290
false
291291
end
292292

293293
private
294294

295-
def _ttl_compatibility_check
295+
def ttl_compatibility_check?
296296
if @ttl_attribute
297297
ttl_status = @client.describe_time_to_live(
298298
table_name: @model_class.table_name
@@ -305,7 +305,7 @@ def _ttl_compatibility_check
305305
end
306306
end
307307

308-
def _ttl_match_check
308+
def ttl_match_check?
309309
ttl_status = @client.describe_time_to_live(
310310
table_name: @model_class.table_name
311311
)

lib/aws-record/record/table_migration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TableMigration
1717
# class. If this option is not included, a client will be constructed for
1818
# you with default parameters.
1919
def initialize(model, opts = {})
20-
_assert_model_valid(model)
20+
valid_model?(model)
2121
@model = model
2222
@client = opts[:client] || model.dynamodb_client || Aws::DynamoDB::Client.new
2323
@client.config.user_agent_frameworks << 'aws-record'
@@ -130,7 +130,7 @@ def wait_until_available
130130

131131
private
132132

133-
def _assert_model_valid(model)
133+
def valid_model?(model)
134134
_assert_required_include(model)
135135
model.model_valid?
136136
end

spec/aws-record/record/attributes_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module Record
1515
let(:model) do
1616
Class.new do
1717
include(Aws::Record)
18+
1819
string_attr(:id, hash_key: true)
1920
string_attr(:body)
2021
end
@@ -171,6 +172,7 @@ module Record
171172
let(:klass) do
172173
Class.new do
173174
include(Aws::Record)
175+
174176
set_table_name('TestTable')
175177
integer_attr(:id, hash_key: true)
176178
atomic_counter(:counter)
@@ -244,6 +246,7 @@ module Record
244246
let(:parent_model) do
245247
Class.new do
246248
include(Aws::Record)
249+
247250
integer_attr(:id, hash_key: true)
248251
date_attr(:date, range_key: true)
249252
list_attr(:list)
@@ -253,13 +256,15 @@ module Record
253256
let(:child_model) do
254257
Class.new(parent_model) do
255258
include(Aws::Record)
259+
256260
string_attr(:body)
257261
end
258262
end
259263

260264
let(:child_model2) do
261265
Class.new(parent_model) do
262266
include(Aws::Record)
267+
263268
string_attr(:body2)
264269
end
265270
end

spec/aws-record/record/batch_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
describe '.write' do
1111
Planet = Class.new do
1212
include(Aws::Record)
13+
1314
integer_attr(:id, hash_key: true)
1415
string_attr(:name, range_key: true)
1516
end
@@ -87,6 +88,7 @@
8788
let(:food) do
8889
Class.new do
8990
include(Aws::Record)
91+
9092
set_table_name('FoodTable')
9193
integer_attr(:id, hash_key: true, database_attribute_name: 'Food ID')
9294
string_attr(:dish, range_key: true)
@@ -97,13 +99,15 @@
9799
let(:breakfast) do
98100
Class.new(food) do
99101
include(Aws::Record)
102+
100103
boolean_attr(:gluten_free)
101104
end
102105
end
103106

104107
let(:drink) do
105108
Class.new do
106109
include(Aws::Record)
110+
107111
set_table_name('DrinkTable')
108112
integer_attr(:id, hash_key: true)
109113
string_attr(:drink)

spec/aws-record/record/dirty_tracking_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
Class.new do
195195
include(ActiveModel::Model)
196196
include(Aws::Record)
197+
197198
set_table_name(:test_table)
198199
string_attr(:mykey, hash_key: true)
199200
string_attr(:body)
@@ -317,6 +318,7 @@
317318
Class.new do
318319
include(Aws::Record)
319320
include(ActiveModel::Validations)
321+
320322
set_table_name('TestTable')
321323
integer_attr(:id, hash_key: true)
322324
string_attr(:body)
@@ -335,6 +337,7 @@
335337
model = Class.new do
336338
include(Aws::Record)
337339
include(ActiveModel::Validations)
340+
338341
set_table_name('TestTable')
339342
integer_attr(:id, hash_key: true)
340343
string_attr(:body)
@@ -424,6 +427,7 @@
424427
model = Class.new do
425428
include(Aws::Record)
426429
include(ActiveModel::Validations)
430+
427431
set_table_name('TestTable')
428432
integer_attr(:id, hash_key: true)
429433
string_attr(:body)
@@ -480,6 +484,7 @@
480484
let(:klass) do
481485
Class.new do
482486
include(Aws::Record)
487+
483488
set_table_name(:test_table)
484489
string_attr(:mykey, hash_key: true)
485490
string_attr(:body)
@@ -493,6 +498,7 @@
493498
let(:klass_with_defaults) do
494499
Class.new do
495500
include(Aws::Record)
501+
496502
set_table_name(:test_table)
497503
string_attr(:mykey, hash_key: true)
498504
map_attr(:dirty_map, default_value: {})

spec/aws-record/record/item_collection_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Record
88
let(:model) do
99
Class.new do
1010
include(Aws::Record)
11+
1112
set_table_name('TestTable')
1213
integer_attr(:id, hash_key: true)
1314
end
@@ -206,6 +207,7 @@ module Record
206207
let(:model_a) do
207208
Class.new do
208209
include(Aws::Record)
210+
209211
set_table_name('TestTable')
210212
integer_attr(:id, hash_key: true)
211213
string_attr(:class_name)
@@ -216,6 +218,7 @@ module Record
216218
let(:model_b) do
217219
Class.new do
218220
include(Aws::Record)
221+
219222
set_table_name('TestTable')
220223
integer_attr(:id, hash_key: true)
221224
string_attr(:class_name)

0 commit comments

Comments
 (0)