rom-repository 2.0.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d57ced9a95ec63c4c94964e4c2a6bc2fbfefa877
4
- data.tar.gz: 16b8106ef4c4072ef9884d341c0ac18e14e145a5
2
+ SHA256:
3
+ metadata.gz: c3728521e0647f8bf92fcb9955dc6826687d8375f661161ad1152463311627a0
4
+ data.tar.gz: 73414da332fbe36d1ac31c578ac356572139d12755054d006af4a2210e228486
5
5
  SHA512:
6
- metadata.gz: 1decbd9264793893e240683b50e1c2f99b7c9b901bc766b3170bd25bd86ccc80f41069bc1335788f61af12a93cfdd6c8c7861c0f1409702be750a82d004c3394
7
- data.tar.gz: 2106d11f6a02eff602265ee734d9fb5b9614155248472f914abda60e447b066729980de213b8e7c39f0f101093f287392d8ba760396dc7d727cf8177ebe6f230
6
+ metadata.gz: baac348e130e1c915a54c8b08281ac3b86bf2bd770419439a4bfcf81498c3a10ab6bfebbca1ad187937dd4807e3a61d4e8c82f283198909a10d70b1241753506
7
+ data.tar.gz: 0efa23fa59c61f98e7b9a3e93d4ab205ba6809b6f0d51e8afe2b2b59cf82d15b1819bb9e8beb8d278f31b70ded6fa387e5b93d8ace709516f6369afa89864423
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # To be released
2
+
3
+ ### Changed
4
+
5
+ * [BREAKING] `Repository::Root#aggregate` was removed in favor of `Relation#combine` (v-kolesnikov)
6
+
1
7
  # v2.0.2 2017-12-01
2
8
 
3
9
  ## Added
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  [gem]: https://rubygems.org/gems/rom-repository
2
- [gemnasium]: https://gemnasium.com/rom-rb/rom-repository
3
2
 
4
3
  # rom-repository
5
4
 
6
5
  [![Gem Version](https://badge.fury.io/rb/rom-repository.svg)][gem]
7
- [![Dependency Status](https://gemnasium.com/rom-rb/rom-repository.svg)][gemnasium]
8
6
 
9
7
  Repositories for [rom-rb](https://github.com/rom-rb/rom) with auto-mapping, changesets and commands.
10
8
 
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rom/core'
2
4
  require 'rom/repository'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/core/cache'
2
4
  require 'dry/core/class_attributes'
3
5
 
@@ -86,7 +88,7 @@ module ROM
86
88
 
87
89
  # @!attribute [r] container
88
90
  # @return [ROM::Container] The container used to set up a repo
89
- param :container, allow: ROM::Container
91
+ option :container, allow: ROM::Container
90
92
 
91
93
  # @!attribute [r] struct_namespace
92
94
  # @return [Module,Class] The namespace for auto-generated structs
@@ -100,13 +102,10 @@ module ROM
100
102
  # @return [RelationRegistry] The relation proxy registry used by a repo
101
103
  attr_reader :relations
102
104
 
103
- # Initializes a new repo by establishing configured relation proxies from
104
- # the passed container
105
- #
106
- # @param container [ROM::Container] The rom container with relations and optional commands
105
+ # Initializes a new repository object
107
106
  #
108
107
  # @api private
109
- def initialize(container, options = EMPTY_HASH)
108
+ def initialize(*)
110
109
  super
111
110
  @relations = {}
112
111
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/core/cache'
2
4
 
3
5
  require 'rom/repository/relation_reader'
@@ -28,22 +30,36 @@ module ROM
28
30
  end
29
31
  end
30
32
 
31
- # Initialize a new repository object
33
+ # Initialize a new repository object, establishing configured relation proxies from
34
+ # the passed container
35
+ #
36
+ # @overload new(container, **options)
37
+ # Initialize with container as leading parameter
38
+ #
39
+ # @param [ROM::Container] container Finalized rom container
32
40
  #
33
- # @param [ROM::Container] container Finalized rom container
41
+ # @param [Hash] options Repository options
42
+ # @option options [Module] :struct_namespace Custom struct namespace
43
+ # @option options [Boolean] :auto_struct Enable/Disable auto-struct mapping
34
44
  #
35
- # @param [Hash] options Repository options
36
- # @option options [Module] :struct_namespace Custom struct namespace
37
- # @option options [Boolean] :auto_struct Enable/Disable auto-struct mapping
45
+ # @overload new(**options)
46
+ # Inititalize with container as option
47
+ #
48
+ # @param [Hash] options Repository options
49
+ # @option options [ROM::Container] :container Finalized rom container
50
+ # @option options [Module] :struct_namespace Custom struct namespace
51
+ # @option options [Boolean] :auto_struct Enable/Disable auto-struct mapping
38
52
  #
39
53
  # @api public
40
- def new(container, options = EMPTY_HASH)
54
+ def new(container = nil, **options)
55
+ container ||= options.fetch(:container)
56
+
41
57
  unless relation_reader
42
58
  relation_reader(RelationReader.new(self, container.relations.elements.keys))
43
59
  include(relation_reader)
44
60
  end
45
61
 
46
- super
62
+ super(options.merge(container: container))
47
63
  end
48
64
 
49
65
  # Inherits configured relations and commands
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ROM
2
4
  class Repository
3
5
  # @api private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/core/class_attributes'
2
4
 
3
5
  module ROM
@@ -56,48 +58,10 @@ module ROM
56
58
  end
57
59
 
58
60
  # @see Repository#initialize
59
- def initialize(container, options = EMPTY_HASH)
61
+ def initialize(*)
60
62
  super
61
63
  @root = set_relation(self.class.root)
62
64
  end
63
-
64
- # Compose a relation aggregate from the root relation
65
- #
66
- # @overload aggregate(*associations)
67
- # Composes an aggregate from configured associations on the root relation
68
- #
69
- # @example
70
- # user_repo.aggregate(:tasks, :posts)
71
- #
72
- # @param *associations [Array<Symbol>] A list of association names
73
- #
74
- # @overload aggregate(*associations, *assoc_opts)
75
- # Composes an aggregate from configured associations and assoc opts
76
- # on the root relation
77
- #
78
- # @example
79
- # user_repo.aggregate(:tasks, posts: :tags)
80
- #
81
- # @param *associations [Array<Symbol>] A list of association names
82
- # @param [Hash] Association options for nested aggregates
83
- #
84
- # @overload aggregate(options)
85
- # Composes an aggregate by delegating to combine method.
86
- #
87
- # @example
88
- # user_repo.aggregate(tasks: :labels)
89
- # user_repo.aggregate(posts: [:tags, :comments])
90
- #
91
- # @param options [Hash] An option hash
92
- #
93
- # @see Relation::Combine#combine_children
94
- #
95
- # @return [Relation]
96
- #
97
- # @api public
98
- def aggregate(*args)
99
- root.combine(*args)
100
- end
101
65
  end
102
66
  end
103
67
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/equalizer'
2
4
 
3
5
  module ROM
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ROM
2
4
  class Repository
3
- VERSION = '2.0.2'.freeze
5
+ VERSION = '5.0.0'
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-repository
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 5.0.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-12-01 00:00:00.000000000 Z
11
+ date: 2019-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '2.0'
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.1
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: dry-core
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0.3'
39
+ version: '0.4'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0.3'
46
+ version: '0.4'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rom-core
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '4.0'
53
+ version: '5.0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '4.0'
60
+ version: '5.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -115,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
121
  - !ruby/object:Gem::Version
116
122
  version: '0'
117
123
  requirements: []
118
- rubyforge_project:
119
- rubygems_version: 2.6.11
124
+ rubygems_version: 3.0.3
120
125
  signing_key:
121
126
  specification_version: 4
122
127
  summary: Repository abstraction for rom-rb