rom 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/rom/setup/finalize.rb +7 -3
- data/lib/rom/setup/finalize/finalize_relations.rb +11 -2
- data/lib/rom/version.rb +1 -1
- data/spec/integration/setup_spec.rb +3 -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: 2c8052ad74ae5b51b3c93fdf26f763c9b4311c03
|
4
|
+
data.tar.gz: 7b08d6d109408b867d9835091f2659113677d9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104cc004f3767ad8ce1907597ef7d93b2eca030517cacc174830c391ce64e09f367980b0f6d271be535286c2cbd4fb949bae1d656b32b604011b353450abf5ff
|
7
|
+
data.tar.gz: c82137cf1b58dfa77ac280b0847c78625eb0fd86f0da3d416f71b2cf5340f9342703086d40681b482813ca0d2be10461db3c04c044133bf6b975e435ce7ac039
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v3.3.1 2017-07-09
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
* `Relation#map_with` works with custom mappers (solnic)
|
6
|
+
|
7
|
+
[Compare v3.3.0...v3.3.1](https://github.com/rom-rb/rom/compare/v3.3.0...v3.3.1)
|
8
|
+
|
1
9
|
# v3.3.0 2017-07-05
|
2
10
|
|
3
11
|
This release only adds deprecation warnings in preparation for rom 4.0 release.
|
data/lib/rom/setup/finalize.rb
CHANGED
@@ -61,8 +61,8 @@ module ROM
|
|
61
61
|
def run!
|
62
62
|
infer_relations
|
63
63
|
|
64
|
-
relations = load_relations
|
65
64
|
mappers = load_mappers
|
65
|
+
relations = load_relations(mappers)
|
66
66
|
commands = load_commands(relations)
|
67
67
|
|
68
68
|
container = Container.new(gateways, relations, mappers, commands)
|
@@ -91,8 +91,12 @@ module ROM
|
|
91
91
|
# This includes both classes created via DSL and explicit definitions
|
92
92
|
#
|
93
93
|
# @api private
|
94
|
-
def load_relations
|
95
|
-
FinalizeRelations.new(
|
94
|
+
def load_relations(mappers)
|
95
|
+
FinalizeRelations.new(
|
96
|
+
gateways,
|
97
|
+
relation_classes,
|
98
|
+
mappers: mappers, plugins: plugins.select(&:relation?)
|
99
|
+
).run!
|
96
100
|
end
|
97
101
|
|
98
102
|
# @api private
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rom/relation_registry'
|
2
|
+
require 'rom/mapper_registry'
|
2
3
|
|
3
4
|
module ROM
|
4
5
|
class Finalize
|
@@ -11,9 +12,10 @@ module ROM
|
|
11
12
|
# @param [Array] relation_classes a list of relation descendants
|
12
13
|
#
|
13
14
|
# @api private
|
14
|
-
def initialize(gateways, relation_classes, plugins
|
15
|
+
def initialize(gateways, relation_classes, mappers: EMPTY_HASH, plugins: EMPTY_ARRAY)
|
15
16
|
@gateways = gateways
|
16
17
|
@relation_classes = relation_classes
|
18
|
+
@mappers = mappers
|
17
19
|
@plugins = plugins
|
18
20
|
end
|
19
21
|
|
@@ -58,9 +60,16 @@ module ROM
|
|
58
60
|
plugin.apply_to(klass)
|
59
61
|
end
|
60
62
|
|
63
|
+
relname = klass.register_as
|
61
64
|
dataset = gateway.dataset(klass.schema.name.dataset).instance_exec(klass, &ds_proc)
|
65
|
+
mappers = @mappers.key?(relname) ? @mappers[relname] : MapperRegistry.new
|
62
66
|
|
63
|
-
options = {
|
67
|
+
options = {
|
68
|
+
__registry__: registry,
|
69
|
+
schema: schema.with(relations: registry),
|
70
|
+
mappers: mappers,
|
71
|
+
**plugin_options
|
72
|
+
}
|
64
73
|
|
65
74
|
klass.new(dataset, options)
|
66
75
|
end
|
data/lib/rom/version.rb
CHANGED
@@ -113,6 +113,9 @@ RSpec.describe 'Configuring ROM' do
|
|
113
113
|
|
114
114
|
expect(container.relation(:users).by_name('Jane').as(:users).to_a)
|
115
115
|
.to eql([Test::User.new(name: 'Jane')])
|
116
|
+
|
117
|
+
expect(container.relations[:users].map_with(:users).to_a)
|
118
|
+
.to eql([Test::User.new(name: 'Jane')])
|
116
119
|
end
|
117
120
|
end
|
118
121
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|