rom-mapper 1.1.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: 5eb225274818fe1f0c8b28f4ee6b4637425b2737
4
- data.tar.gz: f3998ff9d212dc4be99f92bd391d37d5b0f8d37b
2
+ SHA256:
3
+ metadata.gz: 4149ea3fe57952060ee08e3932c45d121f4c93e752333b502b16941deef30827
4
+ data.tar.gz: 2683c0af80f90cb031bbca8cba5ec7c2267deb9b6708f702b4f7ff02a9e27810
5
5
  SHA512:
6
- metadata.gz: d22010132f1513a500a37f6e3129e1b4f4d8af3f6f60a4c5e450b8cdb2568587648c66266e1478581d25d58fc3dd73a2c00cfa0fe5fa3e7f901b8ecda4a14dff
7
- data.tar.gz: 88861915365bca292927e001358735a4d805987c215fd86f3293b7d6c058662d8f9594d49d34c0da0be13539a5eebdf70e7c457b39ddf898abcca1a6f263a2bb
6
+ metadata.gz: 569075b89b43c815ab029333b6c2327f3ccad50cfe109e3c62a9f596223af81138265e1416eec75711e71ad5ec7cc0ac1f188054e8c11d5109db4c33a35db0ca
7
+ data.tar.gz: b3e1157ced9c72808fa405e9d4708db7496232b8583b10cb9882fb71c5ca68ac3e384893f2de94fcbcc4c724321bcc137bb58516c2a90f41a5ce17c94cd78fac
@@ -1,3 +1,9 @@
1
+ # 1.2.0 2018-03-29
2
+
3
+ ## Added
4
+
5
+ * Custom `MapperCompiler` subclass can provide mapper options via `mapper_options(...)` class attribute (solnic)
6
+
1
7
  # 1.1.0 2017-11-17
2
8
 
3
9
  ### Fixed
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  class Mapper
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
@@ -1,3 +1,6 @@
1
+ require 'dry/core/class_attributes'
2
+
3
+ require 'rom/constants'
1
4
  require 'rom/initializer'
2
5
  require 'rom/mapper'
3
6
  require 'rom/struct'
@@ -7,16 +10,24 @@ require 'rom/cache'
7
10
  module ROM
8
11
  # @api private
9
12
  class MapperCompiler
13
+ extend Dry::Core::ClassAttributes
10
14
  extend Initializer
11
15
 
16
+ defines :mapper_options
17
+
18
+ mapper_options(EMPTY_HASH)
19
+
12
20
  option :cache, default: -> { Cache.new }
13
21
 
14
22
  attr_reader :struct_compiler
15
23
 
24
+ attr_reader :mapper_options
25
+
16
26
  def initialize(*args)
17
27
  super
18
28
  @struct_compiler = StructCompiler.new(cache: cache)
19
29
  @cache = cache.namespaced(:mappers)
30
+ @mapper_options = self.class.mapper_options
20
31
  end
21
32
 
22
33
  def call(ast)
@@ -44,7 +55,7 @@ module ROM
44
55
  end
45
56
  end
46
57
 
47
- options = [header.map(&method(:visit)), model: model]
58
+ options = [header.map(&method(:visit)), mapper_options.merge(model: model)]
48
59
 
49
60
  if meta[:combine_type]
50
61
  type = meta[:combine_type] == :many ? :array : :hash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
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-11-17 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.6.11
151
+ rubygems_version: 2.7.4
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Standalone data mappers integrated with rom-rb