rom-mapper 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +1 -1
- data/lib/rom/mapper/version.rb +1 -1
- data/lib/rom/mapper_compiler.rb +2 -2
- data/lib/rom/model_builder.rb +2 -2
- data/lib/rom/struct.rb +14 -12
- data/lib/rom/struct_compiler.rb +8 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eb225274818fe1f0c8b28f4ee6b4637425b2737
|
4
|
+
data.tar.gz: f3998ff9d212dc4be99f92bd391d37d5b0f8d37b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22010132f1513a500a37f6e3129e1b4f4d8af3f6f60a4c5e450b8cdb2568587648c66266e1478581d25d58fc3dd73a2c00cfa0fe5fa3e7f901b8ecda4a14dff
|
7
|
+
data.tar.gz: 88861915365bca292927e001358735a4d805987c215fd86f3293b7d6c058662d8f9594d49d34c0da0be13539a5eebdf70e7c457b39ddf898abcca1a6f263a2bb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
# 1.1.0 2017-11-17
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
* Aliased attributes are handled correctly by mapper compiler (solnic)
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
* Mapper compiler no longer handles wrapped attributes in an SQL-specific way (solnic)
|
10
|
+
|
11
|
+
# 1.0.2 2017-11-02
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
* Missing dependency on `dry-struct` was added (solnic)
|
16
|
+
|
17
|
+
# 1.0.1 2017-10-22
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
* Support for inferred enum schema attributes (solnic)
|
22
|
+
|
23
|
+
[Compare v4.0.0..v4.0.1](https://github.com/rom-rb/rom-mapper/compare/v4.0.0...v4.0.1)
|
24
|
+
|
1
25
|
# 1.0.0 2017-10-18
|
2
26
|
|
3
27
|
### Added
|
data/README.md
CHANGED
data/lib/rom/mapper/version.rb
CHANGED
data/lib/rom/mapper_compiler.rb
CHANGED
data/lib/rom/model_builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rom/support/inflector'
|
2
2
|
|
3
3
|
module ROM
|
4
4
|
# Model builders can be used to build model classes for mappers
|
@@ -54,7 +54,7 @@ module ROM
|
|
54
54
|
|
55
55
|
@namespace =
|
56
56
|
if parts.any?
|
57
|
-
|
57
|
+
Inflector.constantize(parts.join('::'))
|
58
58
|
else
|
59
59
|
Object
|
60
60
|
end
|
data/lib/rom/struct.rb
CHANGED
@@ -70,7 +70,16 @@ module ROM
|
|
70
70
|
#
|
71
71
|
# @api public
|
72
72
|
class Struct < Dry::Struct
|
73
|
-
MissingAttribute = Class.new(NameError)
|
73
|
+
MissingAttribute = Class.new(NameError) do
|
74
|
+
def initialize(&block)
|
75
|
+
super
|
76
|
+
@message_proc = block
|
77
|
+
end
|
78
|
+
|
79
|
+
def message
|
80
|
+
@message_proc.call
|
81
|
+
end
|
82
|
+
end
|
74
83
|
|
75
84
|
# Returns a short string representation
|
76
85
|
#
|
@@ -90,16 +99,9 @@ module ROM
|
|
90
99
|
__send__(name)
|
91
100
|
end
|
92
101
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
super
|
97
|
-
end
|
98
|
-
else
|
99
|
-
# @api private
|
100
|
-
def respond_to_missing?(*)
|
101
|
-
super
|
102
|
-
end
|
102
|
+
# @api private
|
103
|
+
def respond_to_missing?(*)
|
104
|
+
super
|
103
105
|
end
|
104
106
|
|
105
107
|
private
|
@@ -107,7 +109,7 @@ module ROM
|
|
107
109
|
def method_missing(*)
|
108
110
|
super
|
109
111
|
rescue NameError => error
|
110
|
-
raise MissingAttribute.new
|
112
|
+
raise MissingAttribute.new { "#{ error.message } (attribute not loaded?)" }
|
111
113
|
end
|
112
114
|
end
|
113
115
|
end
|
data/lib/rom/struct_compiler.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rom/support/inflector'
|
2
2
|
require 'dry/core/class_builder'
|
3
3
|
require 'dry/types/compiler'
|
4
4
|
|
@@ -89,6 +89,12 @@ module ROM
|
|
89
89
|
visit(definition)
|
90
90
|
end
|
91
91
|
|
92
|
+
# @api private
|
93
|
+
def visit_enum(node)
|
94
|
+
type_node, * = node
|
95
|
+
visit(type_node)
|
96
|
+
end
|
97
|
+
|
92
98
|
# @api private
|
93
99
|
def build_class(name, parent, ns, &block)
|
94
100
|
Dry::Core::ClassBuilder.
|
@@ -98,7 +104,7 @@ module ROM
|
|
98
104
|
|
99
105
|
# @api private
|
100
106
|
def class_name(name)
|
101
|
-
|
107
|
+
Inflector.classify(Inflector.singularize(name))
|
102
108
|
end
|
103
109
|
end
|
104
110
|
end
|
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.
|
4
|
+
version: 1.1.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
|
+
date: 2017-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-equalizer
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 0.3.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: dry-struct
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.3'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.3'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: transproc
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|