dynamini 2.10.4 → 2.11.1

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: d1dfadadd461e3d1446b230c7510d45eb4011237
4
- data.tar.gz: c9aa33b1b4f3a553f1633b028b451d82d47657ef
3
+ metadata.gz: 57e821a0bc5b22015ec93c1a14b4618abfaf93dd
4
+ data.tar.gz: da7cec18f2a3a5a822b63fe6cfd14210196fffb8
5
5
  SHA512:
6
- metadata.gz: c0b3dfe217e6fe46b50897b91f3b79e24987461e504df2eb35b67b7775b5334d4f9541ea77054e72baba822bcb3ac26bb5f75516914ca1b307ac8a53cd4f7539
7
- data.tar.gz: ffc8b016f7553a171bb82f722f0ff8bfd23a8a3afa013b899ed4d7a0bc909f3b210436fa9e6711084aef1ce496bb1fc15bd8def6be2f4292203b17efadf85398
6
+ metadata.gz: 9833c5aba2fe9ba980f4c294954f1647d46744d34e3720ca0aa2acfbbb251f4297dd652e2baeaeec2cc8f3fe0295c2095f23235d0edf7bf54d43284251ba2a81
7
+ data.tar.gz: b12415f6d442d49da0729cf566cf95a71f038dd70093acfe7f5822a2a5749ad173e40dfbaa99ed91cdb7aec82c6da46a447a77fbdfb601d8dc79f49ad18ed566
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynamini (2.10.3)
4
+ dynamini (2.11.1)
5
5
  activemodel (>= 3, < 5.0)
6
6
  aws-sdk (~> 2)
7
7
 
@@ -16,16 +16,17 @@ GEM
16
16
  minitest (~> 5.1)
17
17
  thread_safe (~> 0.3, >= 0.3.4)
18
18
  tzinfo (~> 1.1)
19
- aws-sdk (2.10.55)
20
- aws-sdk-resources (= 2.10.55)
21
- aws-sdk-core (2.10.55)
19
+ aws-sdk (2.10.131)
20
+ aws-sdk-resources (= 2.10.131)
21
+ aws-sdk-core (2.10.131)
22
22
  aws-sigv4 (~> 1.0)
23
23
  jmespath (~> 1.0)
24
- aws-sdk-resources (2.10.55)
25
- aws-sdk-core (= 2.10.55)
24
+ aws-sdk-resources (2.10.131)
25
+ aws-sdk-core (= 2.10.131)
26
26
  aws-sigv4 (1.0.2)
27
27
  builder (3.2.3)
28
28
  coderay (1.1.0)
29
+ concurrent-ruby (1.0.5)
29
30
  diff-lcs (1.2.5)
30
31
  ffi (1.9.10)
31
32
  formatador (0.2.5)
@@ -49,14 +50,15 @@ GEM
49
50
  guard-shell (0.7.1)
50
51
  guard (>= 2.0.0)
51
52
  guard-compat (~> 1.0)
52
- i18n (0.8.6)
53
+ i18n (0.9.5)
54
+ concurrent-ruby (~> 1.0)
53
55
  jmespath (1.3.1)
54
56
  listen (3.0.3)
55
57
  rb-fsevent (>= 0.9.3)
56
58
  rb-inotify (>= 0.9)
57
59
  lumberjack (1.0.9)
58
60
  method_source (0.8.2)
59
- minitest (5.10.3)
61
+ minitest (5.11.3)
60
62
  nenv (0.2.0)
61
63
  notiffany (0.0.8)
62
64
  nenv (~> 0.1)
@@ -86,7 +88,7 @@ GEM
86
88
  slop (3.6.0)
87
89
  thor (0.19.1)
88
90
  thread_safe (0.3.6)
89
- tzinfo (1.2.3)
91
+ tzinfo (1.2.5)
90
92
  thread_safe (~> 0.1)
91
93
 
92
94
  PLATFORMS
data/dynamini.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'dynamini'
3
- s.version = '2.10.4'
3
+ s.version = '2.11.1'
4
4
  s.summary = 'DynamoDB interface'
5
5
  s.description = 'Lightweight DynamoDB interface gem designed as
6
6
  a drop-in replacement for ActiveRecord.
@@ -77,7 +77,7 @@ module Dynamini
77
77
  write_attribute(attribute_name(name), args.first)
78
78
  elsif was_method?(name)
79
79
  __was(name)
80
- elsif read_method?(name)
80
+ elsif args.empty? && read_method?(name)
81
81
  read_attribute(name)
82
82
  else
83
83
  super
@@ -21,20 +21,20 @@ module Dynamini
21
21
  symbol: proc { |v| v.to_sym if v },
22
22
  string: proc { |v| v.to_s if v },
23
23
  boolean: proc { |v| v },
24
- array: proc { |v| v.is_a?(Enumerable) ? v.to_a : [v] },
25
- set: proc { |v| v.is_a?(Enumerable) ? Set.new(v) : Set.new([v]) }
24
+ array: proc { |v| (v.is_a?(Enumerable) ? v.to_a : [v]) if v },
25
+ set: proc { |v| (v.is_a?(Enumerable) ? Set.new(v) : Set.new([v])) if v }
26
26
  }.freeze
27
27
 
28
28
  SETTER_PROCS = {
29
29
  integer: proc { |v| v.to_i if v },
30
- time: proc { |v| (v.is_a?(Date) ? v.to_time : v).to_f },
30
+ time: proc { |v| (v.is_a?(Date) ? v.to_time : v).to_f if v },
31
31
  float: proc { |v| v.to_f if v },
32
32
  symbol: proc { |v| v.to_s if v },
33
33
  string: proc { |v| v.to_s if v },
34
34
  boolean: proc { |v| v },
35
35
  date: proc { |v| v.to_time.to_f if v },
36
- array: proc { |v| v.is_a?(Enumerable) ? v.to_a : [v] },
37
- set: proc { |v| v.is_a?(Enumerable) ? Set.new(v) : Set.new([v]) }
36
+ array: proc { |v| (v.is_a?(Enumerable) ? v.to_a : [v]) if v },
37
+ set: proc { |v| (v.is_a?(Enumerable) ? Set.new(v) : Set.new([v])) if v }
38
38
  }.freeze
39
39
 
40
40
  def handle(column, format_class, options = {})
@@ -72,6 +72,10 @@ describe Dynamini::Attributes do
72
72
  expect(model).not_to respond_to(:foo)
73
73
  end
74
74
 
75
+ it 'does not treat method calls with arguments as readers' do
76
+ expect{ model.accidental_method_call(1,2,3) }.to raise_error NoMethodError
77
+ end
78
+
75
79
  context 'existing attribute' do
76
80
  it 'should return the attribute' do
77
81
  expect(model.price).to eq(9.99)
@@ -553,4 +553,19 @@ describe Dynamini::TestClient do
553
553
  end
554
554
  end
555
555
  end
556
+
557
+ xdescribe 'polymorphism with shared table' do
558
+ class SuperClass < Dynamini::Base
559
+ set_table_name 'my_table'
560
+ end
561
+
562
+ class SubClass < SuperClass
563
+ set_table_name 'my_table'
564
+ end
565
+
566
+ it 'shares the same client' do
567
+ SuperClass.create!(id: 'abc', foo: 'bar')
568
+ expect(SubClass.find('abc').foo).to eq('bar')
569
+ end
570
+ end
556
571
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamini
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.4
4
+ version: 2.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Ward
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-11-15 00:00:00.000000000 Z
18
+ date: 2018-02-14 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemodel