ree_lib 1.0.106 → 1.0.107

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 558dbd22038f40db477b968aa0595ca664484c05606827276b2d872ad6eb5dab
4
- data.tar.gz: f190528d1cf21d60f1403252fd16d6e9e62beb291b4cddcca2af03f77bddce85
3
+ metadata.gz: 28f3adfaea70ca8f4acd1b767181790a4b90e0af65449745e0e499f80353f78d
4
+ data.tar.gz: feae7ca14b04d4360866547e84773b402d97fc1c0b9546de1f45c2334cc4db99
5
5
  SHA512:
6
- metadata.gz: b5f0cf27786a919265f1c01982c7f8640e5b27edf837ed9a207243e6c513f3a97ab2487ad4c16ebc01feb7d7641509d38b336ef77024fb325b059aa32a61d96e
7
- data.tar.gz: 6ddd53ea7f83cded5374da832c06ef845062c2574e832ccfec241602722a63a32390f78f02fc50f2d030f94b7e1cf404e976c00fa3237c11607cd2fa96504ee7
6
+ metadata.gz: fd70c16af7f3b3c2f1eaf0c165daee6e5b978e4ea5b36ae7dec584a4a950843555f2a60fe8d0f43b1a6cab7580e749ddf3f76d137404ad78fb7605051cec3ea1
7
+ data.tar.gz: ee42df7d56fbf5911644f40e8b8752842568cbaa7e8794280a6fb9f299f9940fedaca22206ffe2790de96ef341c5df8793c6c3a60af306b79ec29f84c85fe346
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.106)
4
+ ree_lib (1.0.107)
5
5
  bigdecimal (~> 3.1.6)
6
6
  binding_of_caller (~> 1.0.0)
7
7
  i18n (~> 1.14.1)
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.106"
4
+ VERSION = "1.0.107"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.106
4
+ version: 1.0.107
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov