ree_lib 1.0.106 → 1.0.107
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f3adfaea70ca8f4acd1b767181790a4b90e0af65449745e0e499f80353f78d
|
4
|
+
data.tar.gz: feae7ca14b04d4360866547e84773b402d97fc1c0b9546de1f45c2334cc4db99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd70c16af7f3b3c2f1eaf0c165daee6e5b978e4ea5b36ae7dec584a4a950843555f2a60fe8d0f43b1a6cab7580e749ddf3f76d137404ad78fb7605051cec3ea1
|
7
|
+
data.tar.gz: ee42df7d56fbf5911644f40e8b8752842568cbaa7e8794280a6fb9f299f9940fedaca22206ffe2790de96ef341c5df8793c6c3a60af306b79ec29f84c85fe346
|
data/Gemfile.lock
CHANGED
@@ -10,6 +10,7 @@ class ReeDto::BuildDto
|
|
10
10
|
link "ree_dto/dto/dto_instance_methods", -> { DtoInstanceMethods }
|
11
11
|
link "ree_dto/dto/dto_class_methods", -> { DtoClassMethods }
|
12
12
|
link "ree_dto/dto/dto_builder", -> { DtoBuilder }
|
13
|
+
link "ree_dto/dto/dto_collection", -> { DtoCollection }
|
13
14
|
end
|
14
15
|
|
15
16
|
contract(Block => nil)
|
@@ -48,6 +49,24 @@ class ReeDto::BuildDto
|
|
48
49
|
col_class = build_dto_collection_class(collection.contract)
|
49
50
|
col_class.class_exec(&collection.filter_proc)
|
50
51
|
|
52
|
+
klass.instance_exec do
|
53
|
+
contract ArrayOf[collection.contract] => DtoCollection
|
54
|
+
end
|
55
|
+
|
56
|
+
klass.define_method "#{collection.name}=" do |list|
|
57
|
+
col = send(collection.name)
|
58
|
+
|
59
|
+
list.each do |item|
|
60
|
+
col.add(item)
|
61
|
+
end
|
62
|
+
|
63
|
+
col
|
64
|
+
end
|
65
|
+
|
66
|
+
klass.instance_exec do
|
67
|
+
contract None => DtoCollection
|
68
|
+
end
|
69
|
+
|
51
70
|
klass.define_method collection.name do
|
52
71
|
@collections ||= {}
|
53
72
|
|
@@ -92,6 +92,13 @@ RSpec.describe ReeDto::DSL do
|
|
92
92
|
expect(dto.numbers.to_s).to eq("odd_collection")
|
93
93
|
}
|
94
94
|
|
95
|
+
it {
|
96
|
+
dto = ReeDto::DtoClass.new
|
97
|
+
|
98
|
+
dto.numbers = [1, 2, 3, 4]
|
99
|
+
expect(dto.numbers.to_a).to eq([1, 2, 3, 4])
|
100
|
+
}
|
101
|
+
|
95
102
|
it {
|
96
103
|
dto = ReeDto::DtoClass.new
|
97
104
|
|
data/lib/ree_lib/version.rb
CHANGED