ree_lib 1.0.115 → 1.0.116
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/dataset_extensions.rb +2 -3
- data/lib/ree_lib/packages/ree_dto/package/ree_dto/dto/collection_filter.rb +4 -0
- data/lib/ree_lib/packages/ree_dto/package/ree_dto/dto/dto_collection.rb +10 -0
- data/lib/ree_lib/packages/ree_dto/package/ree_dto/dto/dto_instance_methods.rb +22 -10
- data/lib/ree_lib/packages/ree_dto/spec/ree_dto/dsl_spec.rb +1 -1
- data/lib/ree_lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e25eddc0fd59750f4eb166fe3cc3b9b70bde690bc203452749aa3c9961a5ee
|
4
|
+
data.tar.gz: 40dc524a36e3de7b399d1d3453b57a38a8ce52bceebe681fcf160c2590449fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e09f2db0575da0e803ed76c5bd162416e91c15d9c308252d0aa1dc7e7cb85fd3e08bfeb253c95346e2780b3c5987710d07b71f89cecf858ca8b5c433339d5d9
|
7
|
+
data.tar.gz: 3251732d5e69e2f3da4260ce95988a0e647f978234785ff6d3a445d59541155f917d28a3e19efb00eea14bfe53f7432eb42b1c2517cfc32a66fd629558ebf30a
|
data/Gemfile.lock
CHANGED
@@ -46,10 +46,9 @@ module ReeDao
|
|
46
46
|
# @args [ReeDto::Dto, ReeDto::DtoCollection]
|
47
47
|
def persist(*args, set: nil)
|
48
48
|
args.each do |arg|
|
49
|
-
|
50
|
-
when ReeDto::DSL
|
49
|
+
if arg.is_a?(ReeDto::DSL)
|
51
50
|
put_or_update(arg, set: set)
|
52
|
-
|
51
|
+
elsif arg.is_a?(ReeDto::DtoCollection) || arg.is_a?(Array) || arg.is_a?(Enumerable)
|
53
52
|
arg.each { put_or_update(_1, set: set) }
|
54
53
|
end
|
55
54
|
end
|
@@ -23,6 +23,16 @@ class ReeDto::DtoCollection
|
|
23
23
|
@list.each(&block)
|
24
24
|
end
|
25
25
|
|
26
|
+
contract None => String
|
27
|
+
def to_s
|
28
|
+
inspect
|
29
|
+
end
|
30
|
+
|
31
|
+
contract None => String
|
32
|
+
def inspect
|
33
|
+
@list.inspect
|
34
|
+
end
|
35
|
+
|
26
36
|
class << self
|
27
37
|
def filter(name, filter_proc)
|
28
38
|
define_method name do
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "./field_meta"
|
2
|
+
require "date"
|
2
3
|
|
3
4
|
module ReeDto::DtoInstanceMethods
|
4
5
|
include Ree::Contracts::Core
|
@@ -43,7 +44,7 @@ module ReeDto::DtoInstanceMethods
|
|
43
44
|
meta = get_meta(name)
|
44
45
|
|
45
46
|
if !meta.has_default?
|
46
|
-
raise FieldNotSetError.new("field
|
47
|
+
raise FieldNotSetError.new("field `#{name}` not set for: #{self}")
|
47
48
|
else
|
48
49
|
@_attrs[name] = meta.default
|
49
50
|
end
|
@@ -91,21 +92,32 @@ module ReeDto::DtoInstanceMethods
|
|
91
92
|
|
92
93
|
contract None => String
|
93
94
|
def to_s
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
95
|
+
result = "#<dto #{self.class} "
|
96
|
+
|
97
|
+
data = self.class.fields.select { has_value?(_1.name) }.map do |field|
|
98
|
+
"#{field.name}=#{inspect_value(get_value(field.name))}"
|
99
|
+
end
|
100
|
+
|
101
|
+
data += self.class.collections.select { send(_1.name).size > 0 }.map do |col|
|
102
|
+
"#{col.name}=#{send(col.name).inspect}"
|
102
103
|
end
|
103
104
|
|
104
|
-
result << data.join("
|
105
|
+
result << data.join(", ")
|
106
|
+
result << ">"
|
105
107
|
end
|
106
108
|
|
107
109
|
contract None => String
|
108
110
|
def inspect
|
109
111
|
to_s
|
110
112
|
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def inspect_value(v)
|
117
|
+
if v.is_a?(DateTime) || v.is_a?(Date) || v.is_a?(Time)
|
118
|
+
v.to_s.inspect
|
119
|
+
else
|
120
|
+
v.inspect
|
121
|
+
end
|
122
|
+
end
|
111
123
|
end
|
@@ -56,7 +56,7 @@ RSpec.describe ReeDto::DSL do
|
|
56
56
|
expect {
|
57
57
|
dto.string
|
58
58
|
}.to raise_error do |e|
|
59
|
-
expect(e.message).to eq("field
|
59
|
+
expect(e.message).to eq("field `string` not set for: #<dto ReeDto::DtoClass with_default=1>")
|
60
60
|
end
|
61
61
|
}
|
62
62
|
|
data/lib/ree_lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ree_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.116
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ree
|