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 +4 -4
- data/Gemfile.lock +11 -9
- data/dynamini.gemspec +1 -1
- data/lib/dynamini/attributes.rb +1 -1
- data/lib/dynamini/type_handler.rb +5 -5
- data/spec/dynamini/attributes_spec.rb +4 -0
- data/spec/dynamini/test_client_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e821a0bc5b22015ec93c1a14b4618abfaf93dd
|
4
|
+
data.tar.gz: da7cec18f2a3a5a822b63fe6cfd14210196fffb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
20
|
-
aws-sdk-resources (= 2.10.
|
21
|
-
aws-sdk-core (2.10.
|
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.
|
25
|
-
aws-sdk-core (= 2.10.
|
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.
|
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.
|
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.
|
91
|
+
tzinfo (1.2.5)
|
90
92
|
thread_safe (~> 0.1)
|
91
93
|
|
92
94
|
PLATFORMS
|
data/dynamini.gemspec
CHANGED
data/lib/dynamini/attributes.rb
CHANGED
@@ -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.
|
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:
|
18
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activemodel
|