rom-changeset 5.2.3 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rom/changeset/extensions/relation.rb +10 -8
- data/lib/rom/changeset/stateful.rb +13 -14
- data/lib/rom/changeset/update.rb +4 -1
- data/lib/rom/changeset/version.rb +1 -1
- data/lib/rom/changeset.rb +1 -3
- data/lib/rom/plugins/relation/changeset.rb +2 -1
- metadata +10 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73941151ab589fd80e2f349694426b73635ff681387cd678b9b2122e0c06d24a
|
4
|
+
data.tar.gz: 1e272f155fe1617f88f2206e9ee4b673d8780c851e4fc9615f89b8a10e209f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09b80246997d59a8ce86ee87aa7c781102f9160d6ce49f9f21d2aff7cd5a5bb88b3981006a997d9454766b5611ac6c5111fdccc0dd3dc0876e0376212b2bfcd5'
|
7
|
+
data.tar.gz: 3eee18aee1e68b06292173d265bdcf96717ff9bc66daae001e60ae0ed4ec2c9c5edc1b41d5ffe9d936e7dc243d9ea218a3e3822c4d8e31f54b55285f06935ce0
|
@@ -11,14 +11,16 @@ module ROM
|
|
11
11
|
# Changeset extenions for combined relations
|
12
12
|
#
|
13
13
|
# @api public
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
module Relation
|
15
|
+
class Graph
|
16
|
+
# Build a changeset for a combined relation
|
17
|
+
#
|
18
|
+
# @raise NotImplementedError
|
19
|
+
#
|
20
|
+
# @api public
|
21
|
+
def changeset(*)
|
22
|
+
raise NotImplementedError, "Changeset doesn't support combined relations yet"
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -73,9 +73,9 @@ module ROM
|
|
73
73
|
# @return [Array<Pipe>, Transproc::Function>]
|
74
74
|
#
|
75
75
|
# @api public
|
76
|
-
def self.extend(*, &
|
77
|
-
if
|
78
|
-
map(use_for_diff: false, &
|
76
|
+
def self.extend(*, &)
|
77
|
+
if block_given?
|
78
|
+
map(use_for_diff: false, &)
|
79
79
|
else
|
80
80
|
super
|
81
81
|
end
|
@@ -87,7 +87,7 @@ module ROM
|
|
87
87
|
#
|
88
88
|
# @return [Pipe]
|
89
89
|
def self.default_pipe(context)
|
90
|
-
|
90
|
+
pipes.empty? ? EMPTY_PIPE : pipes.map { |p| p.bind(context) }.reduce(:>>)
|
91
91
|
end
|
92
92
|
|
93
93
|
# @api private
|
@@ -131,8 +131,8 @@ module ROM
|
|
131
131
|
# @return [Changeset]
|
132
132
|
#
|
133
133
|
# @api public
|
134
|
-
def map(*steps, &
|
135
|
-
extend(*steps, for_diff: true, &
|
134
|
+
def map(*steps, &)
|
135
|
+
extend(*steps, for_diff: true, &)
|
136
136
|
end
|
137
137
|
|
138
138
|
# Pipe changeset's data using custom steps define on the pipe.
|
@@ -148,12 +148,12 @@ module ROM
|
|
148
148
|
# @return [Changeset]
|
149
149
|
#
|
150
150
|
# @api public
|
151
|
-
def extend(*steps, **options, &
|
152
|
-
if
|
153
|
-
if
|
154
|
-
|
151
|
+
def extend(*steps, **options, &)
|
152
|
+
if block_given?
|
153
|
+
if steps.empty?
|
154
|
+
with(pipe: pipe.compose(Pipe.new(proc(&)).bind(self), **options))
|
155
155
|
else
|
156
|
-
|
156
|
+
extend(*steps, **options).extend(**options, &)
|
157
157
|
end
|
158
158
|
else
|
159
159
|
with(pipe: steps.reduce(pipe.with(**options)) { |a, e| a.compose(pipe[e], **options) })
|
@@ -266,9 +266,9 @@ module ROM
|
|
266
266
|
end
|
267
267
|
|
268
268
|
# @api private
|
269
|
-
def method_missing(meth,
|
269
|
+
def method_missing(meth, ...)
|
270
270
|
if __data__.respond_to?(meth)
|
271
|
-
response = __data__.__send__(meth,
|
271
|
+
response = __data__.__send__(meth, ...)
|
272
272
|
|
273
273
|
if response.is_a?(__data__.class)
|
274
274
|
with(__data__: response)
|
@@ -279,7 +279,6 @@ module ROM
|
|
279
279
|
super
|
280
280
|
end
|
281
281
|
end
|
282
|
-
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
|
283
282
|
end
|
284
283
|
end
|
285
284
|
end
|
data/lib/rom/changeset/update.rb
CHANGED
@@ -62,6 +62,8 @@ module ROM
|
|
62
62
|
# @return [Hash]
|
63
63
|
#
|
64
64
|
# @api public
|
65
|
+
#
|
66
|
+
# rubocop:disable Metrics/AbcSize
|
65
67
|
def diff
|
66
68
|
@diff ||=
|
67
69
|
begin
|
@@ -73,9 +75,10 @@ module ROM
|
|
73
75
|
new_tuple = data_tuple.to_a.select { |k, _| data_keys.include?(k) }
|
74
76
|
ori_tuple = source.to_a.select { |k, _| data_keys.include?(k) }
|
75
77
|
|
76
|
-
|
78
|
+
(new_tuple - (new_tuple & ori_tuple)).to_h
|
77
79
|
end
|
78
80
|
end
|
81
|
+
# rubocop:enable Metrics/AbcSize
|
79
82
|
end
|
80
83
|
end
|
81
84
|
end
|
data/lib/rom/changeset.rb
CHANGED
@@ -94,7 +94,8 @@ module ROM
|
|
94
94
|
end
|
95
95
|
rescue KeyError
|
96
96
|
raise ArgumentError,
|
97
|
-
"+#{type.inspect}+ is not a valid changeset type.
|
97
|
+
"+#{type.inspect}+ is not a valid changeset type. " \
|
98
|
+
"Must be one of: #{TYPES.keys.inspect}"
|
98
99
|
end
|
99
100
|
end
|
100
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-changeset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-08 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: dry-core
|
@@ -16,76 +15,42 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
18
|
+
version: '1.0'
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
25
|
+
version: '1.0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: rom-core
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - "~>"
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
32
|
+
version: '5.4'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
39
|
+
version: '5.4'
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: transproc
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 1.1.0
|
46
|
+
version: '1.1'
|
51
47
|
type: :runtime
|
52
48
|
prerelease: false
|
53
49
|
version_requirements: !ruby/object:Gem::Requirement
|
54
50
|
requirements:
|
55
51
|
- - "~>"
|
56
52
|
- !ruby/object:Gem::Version
|
57
|
-
version: '1.
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 1.1.0
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rake
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '11.2'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - "~>"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '11.2'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rspec
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '3.5'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '3.5'
|
53
|
+
version: '1.1'
|
89
54
|
description: rom-changeset adds support for preprocessing data on top of rom-rb repositories
|
90
55
|
email: piotr.solnica+oss@gmail.com
|
91
56
|
executables: []
|
@@ -115,7 +80,7 @@ metadata:
|
|
115
80
|
documentation_uri: https://api.rom-rb.org/rom/
|
116
81
|
mailing_list_uri: https://discourse.rom-rb.org/
|
117
82
|
bug_tracker_uri: https://github.com/rom-rb/rom/issues
|
118
|
-
|
83
|
+
rubygems_mfa_required: 'true'
|
119
84
|
rdoc_options: []
|
120
85
|
require_paths:
|
121
86
|
- lib
|
@@ -130,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
95
|
- !ruby/object:Gem::Version
|
131
96
|
version: '0'
|
132
97
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
-
signing_key:
|
98
|
+
rubygems_version: 3.6.2
|
135
99
|
specification_version: 4
|
136
100
|
summary: Changeset abstraction for rom-rb
|
137
101
|
test_files: []
|