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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bab3fbf356319a3e3e057ec3aa75b96597a47b7
4
- data.tar.gz: 2ba353444deeb65f93131c6718b9b365116907c1
3
+ metadata.gz: 5eb225274818fe1f0c8b28f4ee6b4637425b2737
4
+ data.tar.gz: f3998ff9d212dc4be99f92bd391d37d5b0f8d37b
5
5
  SHA512:
6
- metadata.gz: 73f7aea39ddd006b93e01f50c0e41c2d82b2f87966b0e22420efd25701af2af3522ebee038fc197aba178a2e8aaac38d9eba6375a0b22f8e66f34b3b2b03bd67
7
- data.tar.gz: 2ca42e64a64a8408a39689e4ce71e8eb64ccd9fd8969698b6bce877598aa3eb335d24ead7ea34821506a7656f3236d7f4c50a93ac32b29f081b46a68427ce05b
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
@@ -11,7 +11,7 @@ backends. It is the default mapper in ROM.
11
11
 
12
12
  Resources:
13
13
 
14
- - [API documentation](http://rubydoc.info/gems/rom-mapper)
14
+ * [API documentation](http://api.rom-rb.org/rom/)
15
15
 
16
16
  ## License
17
17
 
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  class Mapper
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -61,8 +61,8 @@ module ROM
61
61
  def visit_attribute(node)
62
62
  name, _, meta = node
63
63
 
64
- if meta[:wrapped]
65
- [name, from: meta[:alias]]
64
+ if meta[:alias]
65
+ [meta[:alias], from: name]
66
66
  else
67
67
  [name]
68
68
  end
@@ -1,4 +1,4 @@
1
- require 'dry/core/inflector'
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
- Dry::Core::Inflector.constantize(parts.join('::'))
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
- if RUBY_VERSION < '2.3'
94
- # @api private
95
- def respond_to?(*)
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("#{ error.message } (not loaded attribute?)")
112
+ raise MissingAttribute.new { "#{ error.message } (attribute not loaded?)" }
111
113
  end
112
114
  end
113
115
  end
@@ -1,4 +1,4 @@
1
- require 'dry/core/inflector'
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
- Dry::Core::Inflector.classify(Dry::Core::Inflector.singularize(name))
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.0.0
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-10-18 00:00:00.000000000 Z
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