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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a76e7a694c3096111424b115fe238285183a2e8
4
- data.tar.gz: 27559d733a9470cbdc93878625b5c0157ec56964
3
+ metadata.gz: 2c8052ad74ae5b51b3c93fdf26f763c9b4311c03
4
+ data.tar.gz: 7b08d6d109408b867d9835091f2659113677d9f0
5
5
  SHA512:
6
- metadata.gz: 27fcabc336dde4cee458d52311b3f2eed5934bc5a12055f339a0e7051e14526d14a17fc4aa2d581aa4ccf58ae4fc83357ae87689a328e4b4c2b9c530a5ffa2f6
7
- data.tar.gz: bf6a440ce37fe9953752c8781737361b1cae014afd78d808db2468a71de68c9e0af7bb7d6920227ce4317a25e5bba86ae64b0f1150d20eccf05416f94089108f
6
+ metadata.gz: 104cc004f3767ad8ce1907597ef7d93b2eca030517cacc174830c391ce64e09f367980b0f6d271be535286c2cbd4fb949bae1d656b32b604011b353450abf5ff
7
+ data.tar.gz: c82137cf1b58dfa77ac280b0847c78625eb0fd86f0da3d416f71b2cf5340f9342703086d40681b482813ca0d2be10461db3c04c044133bf6b975e435ce7ac039
@@ -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.
@@ -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(gateways, relation_classes, plugins.select(&:relation?)).run!
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 = EMPTY_ARRAY)
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 = { __registry__: registry, schema: schema.with(relations: registry), **plugin_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
@@ -1,3 +1,3 @@
1
1
  module ROM
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.3.1'.freeze
3
3
  end
@@ -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.0
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-04 00:00:00.000000000 Z
11
+ date: 2017-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby