rom-mapper 1.1.0 → 1.2.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
- SHA1:
3
- metadata.gz: 5eb225274818fe1f0c8b28f4ee6b4637425b2737
4
- data.tar.gz: f3998ff9d212dc4be99f92bd391d37d5b0f8d37b
2
+ SHA256:
3
+ metadata.gz: d3e72a70f05066534695b4439872292d562dc097c86d95c60472aa4d111d3dc5
4
+ data.tar.gz: c8c356ebd0c072894e323c697e200278dea609a84d9367b4f3a8ef66aa6f3ce8
5
5
  SHA512:
6
- metadata.gz: d22010132f1513a500a37f6e3129e1b4f4d8af3f6f60a4c5e450b8cdb2568587648c66266e1478581d25d58fc3dd73a2c00cfa0fe5fa3e7f901b8ecda4a14dff
7
- data.tar.gz: 88861915365bca292927e001358735a4d805987c215fd86f3293b7d6c058662d8f9594d49d34c0da0be13539a5eebdf70e7c457b39ddf898abcca1a6f263a2bb
6
+ metadata.gz: 24eff509f992250b5b6b0f3b3ba19faa54554cad4e7ce0266b6366e10aef0407c25961f146d38f3ba170ab4ddebb012750bd584be3a05a65e8c43b1de4803fb5
7
+ data.tar.gz: e16a20bc63af8df98cc65c4a30c7b4cf6f9e112fd5a1dd30b85834fbb319f2704b862674abe2e0fd8b1a339e727306a0b75443944f4174cb8bdbd99406dd0ee1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 1.2.1 2018-05-03
2
+
3
+ * `dry-types` dependency is constrained with `~> 0.12.1`
4
+
5
+ # 1.2.0 2018-03-29
6
+
7
+ ## Added
8
+
9
+ * Custom `MapperCompiler` subclass can provide mapper options via `mapper_options(...)` class attribute (solnic)
10
+
1
11
  # 1.1.0 2017-11-17
2
12
 
3
13
  ### Fixed
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  class Mapper
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.2.1'.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.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-11-17 00:00:00.000000000 Z
11
+ date: 2018-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer
@@ -44,20 +44,34 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.3.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: dry-types
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.12.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.12.1
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: dry-struct
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
- version: '0.3'
67
+ version: 0.4.0
54
68
  type: :runtime
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - "~>"
59
73
  - !ruby/object:Gem::Version
60
- version: '0.3'
74
+ version: 0.4.0
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: transproc
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
162
  version: '0'
149
163
  requirements: []
150
164
  rubyforge_project:
151
- rubygems_version: 2.6.11
165
+ rubygems_version: 2.7.3
152
166
  signing_key:
153
167
  specification_version: 4
154
168
  summary: Standalone data mappers integrated with rom-rb