rom 0.9.1 → 1.0.0.beta1
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 +4 -4
- data/.rubocop_todo.yml +30 -12
- data/.travis.yml +1 -1
- data/CHANGELOG.md +24 -0
- data/Gemfile +7 -3
- data/README.md +24 -11
- data/lib/rom.rb +9 -26
- data/lib/rom/command.rb +113 -75
- data/lib/rom/commands/class_interface.rb +115 -0
- data/lib/rom/commands/graph.rb +17 -23
- data/lib/rom/commands/graph/builder.rb +176 -0
- data/lib/rom/commands/graph/class_interface.rb +8 -2
- data/lib/rom/commands/graph/input_evaluator.rb +13 -9
- data/lib/rom/commands/lazy.rb +23 -17
- data/lib/rom/commands/lazy/create.rb +23 -0
- data/lib/rom/commands/lazy/delete.rb +27 -0
- data/lib/rom/commands/lazy/update.rb +34 -0
- data/lib/rom/commands/result.rb +14 -0
- data/lib/rom/commands/update.rb +0 -4
- data/lib/rom/configuration.rb +86 -0
- data/lib/rom/{setup_dsl/setup.rb → configuration_dsl.rb} +9 -7
- data/lib/rom/configuration_dsl/command.rb +43 -0
- data/lib/rom/{setup_dsl → configuration_dsl}/command_dsl.rb +5 -4
- data/lib/rom/configuration_dsl/mapper.rb +37 -0
- data/lib/rom/{setup_dsl → configuration_dsl}/mapper_dsl.rb +11 -5
- data/lib/rom/configuration_dsl/relation.rb +26 -0
- data/lib/rom/configuration_plugin.rb +17 -0
- data/lib/rom/constants.rb +5 -12
- data/lib/rom/container.rb +11 -8
- data/lib/rom/create_container.rb +61 -0
- data/lib/rom/environment.rb +27 -241
- data/lib/rom/gateway.rb +18 -2
- data/lib/rom/global.rb +24 -0
- data/lib/rom/global/plugin_dsl.rb +2 -0
- data/lib/rom/lint/spec.rb +0 -12
- data/lib/rom/lint/test.rb +0 -31
- data/lib/rom/memory/commands.rb +2 -2
- data/lib/rom/memory/gateway.rb +2 -0
- data/lib/rom/pipeline.rb +1 -1
- data/lib/rom/plugin_base.rb +1 -1
- data/lib/rom/plugin_registry.rb +12 -10
- data/lib/rom/plugins/configuration/configuration_dsl.rb +16 -0
- data/lib/rom/plugins/relation/key_inference.rb +31 -0
- data/lib/rom/plugins/relation/view.rb +90 -0
- data/lib/rom/plugins/relation/view/dsl.rb +32 -0
- data/lib/rom/relation.rb +1 -11
- data/lib/rom/relation/class_interface.rb +37 -50
- data/lib/rom/setup.rb +13 -104
- data/lib/rom/setup/auto_registration.rb +55 -0
- data/lib/rom/setup/finalize.rb +113 -127
- data/lib/rom/setup/finalize/commands.rb +67 -0
- data/lib/rom/setup/finalize/mappers.rb +36 -0
- data/lib/rom/setup/finalize/relations.rb +53 -0
- data/lib/rom/support/configurable.rb +21 -7
- data/lib/rom/version.rb +1 -1
- data/rakelib/mutant.rake +4 -1
- data/rom.gemspec +3 -4
- data/spec/fixtures/app/commands/create_user.rb +2 -0
- data/spec/fixtures/app/mappers/user_list.rb +2 -0
- data/spec/fixtures/app/relations/users.rb +2 -0
- data/spec/fixtures/lib/persistence/commands/create_user.rb +6 -0
- data/spec/fixtures/lib/persistence/mappers/user_list.rb +6 -0
- data/spec/fixtures/lib/persistence/relations/users.rb +6 -0
- data/spec/{unit/rom → integration}/command_registry_spec.rb +8 -9
- data/spec/integration/commands/create_spec.rb +17 -13
- data/spec/integration/commands/delete_spec.rb +12 -11
- data/spec/integration/commands/error_handling_spec.rb +5 -4
- data/spec/integration/commands/graph_builder_spec.rb +213 -0
- data/spec/integration/commands/graph_spec.rb +112 -49
- data/spec/integration/commands/update_spec.rb +14 -11
- data/spec/integration/commands_spec.rb +60 -0
- data/spec/integration/mappers/combine_spec.rb +7 -6
- data/spec/integration/mappers/deep_embedded_spec.rb +5 -6
- data/spec/integration/mappers/definition_dsl_spec.rb +19 -18
- data/spec/integration/mappers/embedded_spec.rb +11 -12
- data/spec/integration/mappers/exclude_spec.rb +5 -6
- data/spec/integration/mappers/fold_spec.rb +8 -7
- data/spec/integration/mappers/group_spec.rb +16 -15
- data/spec/integration/mappers/overwrite_attributes_value_spec.rb +5 -5
- data/spec/integration/mappers/prefix_separator_spec.rb +5 -7
- data/spec/integration/mappers/prefix_spec.rb +5 -7
- data/spec/integration/mappers/prefixing_attributes_spec.rb +7 -7
- data/spec/integration/mappers/registering_custom_mappers_spec.rb +4 -5
- data/spec/integration/mappers/renaming_attributes_spec.rb +18 -18
- data/spec/integration/mappers/step_spec.rb +11 -12
- data/spec/integration/mappers/symbolizing_attributes_spec.rb +11 -8
- data/spec/integration/mappers/unfold_spec.rb +9 -10
- data/spec/integration/mappers/ungroup_spec.rb +10 -11
- data/spec/integration/mappers/unwrap_spec.rb +10 -15
- data/spec/integration/mappers/wrap_spec.rb +16 -15
- data/spec/{unit/rom → integration}/memory/commands/create_spec.rb +7 -5
- data/spec/{unit/rom → integration}/memory/commands/delete_spec.rb +7 -5
- data/spec/{unit/rom → integration}/memory/commands/update_spec.rb +7 -5
- data/spec/integration/multi_env_spec.rb +16 -124
- data/spec/integration/multi_repo_spec.rb +9 -9
- data/spec/integration/relations/default_dataset_spec.rb +15 -0
- data/spec/integration/relations/inheritance_spec.rb +5 -7
- data/spec/integration/relations/reading_spec.rb +32 -65
- data/spec/integration/relations/registry_dsl_spec.rb +5 -4
- data/spec/integration/repositories/extending_relations_spec.rb +6 -7
- data/spec/integration/repositories/setting_logger_spec.rb +5 -7
- data/spec/integration/setup_spec.rb +49 -61
- data/spec/shared/command_graph.rb +50 -0
- data/spec/shared/container.rb +9 -0
- data/spec/shared/gateway_only.rb +6 -0
- data/spec/shared/no_container.rb +16 -0
- data/spec/shared/one_behavior.rb +4 -4
- data/spec/shared/users_and_tasks.rb +5 -17
- data/spec/spec_helper.rb +5 -3
- data/spec/test/memory_repository_lint_test.rb +1 -1
- data/spec/unit/rom/auto_registration_spec.rb +54 -0
- data/spec/unit/rom/commands/graph_spec.rb +18 -44
- data/spec/unit/rom/commands/lazy_spec.rb +246 -35
- data/spec/unit/rom/commands/result_spec.rb +56 -0
- data/spec/unit/rom/commands_spec.rb +9 -73
- data/spec/unit/rom/configurable_spec.rb +49 -0
- data/spec/unit/rom/configuration_spec.rb +61 -0
- data/spec/unit/rom/container_spec.rb +39 -33
- data/spec/unit/rom/create_container_spec.rb +151 -0
- data/spec/unit/rom/environment_spec.rb +123 -0
- data/spec/unit/rom/gateway_spec.rb +58 -2
- data/spec/unit/rom/global_spec.rb +10 -7
- data/spec/unit/rom/plugin_spec.rb +44 -25
- data/spec/unit/rom/plugins/relation/key_inference_spec.rb +27 -0
- data/spec/unit/rom/plugins/relation/view_spec.rb +47 -0
- data/spec/unit/rom/relation/composite_spec.rb +20 -20
- data/spec/unit/rom/relation/curried_spec.rb +10 -11
- data/spec/unit/rom/relation/graph_spec.rb +27 -27
- data/spec/unit/rom/relation/lazy/combine_spec.rb +26 -20
- data/spec/unit/rom/relation/lazy_spec.rb +38 -38
- data/spec/unit/rom/relation/loaded_spec.rb +2 -3
- data/spec/unit/rom/relation_spec.rb +39 -2
- metadata +58 -66
- data/lib/rom/commands/abstract.rb +0 -184
- data/lib/rom/environment_plugin.rb +0 -17
- data/lib/rom/environment_plugins/auto_registration.rb +0 -38
- data/lib/rom/repository.rb +0 -16
- data/lib/rom/setup_dsl/command.rb +0 -36
- data/lib/rom/setup_dsl/mapper.rb +0 -32
- data/lib/rom/setup_dsl/relation.rb +0 -30
- data/spec/integration/inline_setup_spec.rb +0 -65
- data/spec/unit/rom/repository_spec.rb +0 -12
- data/spec/unit/rom/setup_spec.rb +0 -253
data/lib/rom/gateway.rb
CHANGED
@@ -3,6 +3,10 @@ module ROM
|
|
3
3
|
#
|
4
4
|
# @api public
|
5
5
|
class Gateway
|
6
|
+
extend ClassMacros
|
7
|
+
|
8
|
+
defines :adapter
|
9
|
+
|
6
10
|
# Return connection object
|
7
11
|
#
|
8
12
|
# @return [Object] type varies depending on the gateway
|
@@ -74,7 +78,7 @@ module ROM
|
|
74
78
|
#
|
75
79
|
# @api private
|
76
80
|
def self.class_from_symbol(type)
|
77
|
-
adapter = ROM.adapters.fetch(type)
|
81
|
+
adapter = ROM.adapters.fetch(type) {
|
78
82
|
begin
|
79
83
|
require "rom/#{type}"
|
80
84
|
rescue LoadError
|
@@ -82,7 +86,7 @@ module ROM
|
|
82
86
|
end
|
83
87
|
|
84
88
|
ROM.adapters.fetch(type)
|
85
|
-
|
89
|
+
}
|
86
90
|
|
87
91
|
if adapter.const_defined?(:Gateway)
|
88
92
|
adapter.const_get(:Gateway)
|
@@ -91,6 +95,18 @@ module ROM
|
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
98
|
+
# Returns the adapter, defined for the class
|
99
|
+
#
|
100
|
+
# @return [Symbol]
|
101
|
+
#
|
102
|
+
# @api public
|
103
|
+
def adapter
|
104
|
+
self.class.adapter || raise(
|
105
|
+
MissingAdapterIdentifierError,
|
106
|
+
"gateway class +#{self}+ is missing the adapter identifier"
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
94
110
|
# A generic interface for setting up a logger
|
95
111
|
#
|
96
112
|
# @api public
|
data/lib/rom/global.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rom/plugin_registry'
|
2
2
|
require 'rom/global/plugin_dsl'
|
3
|
+
require 'rom/support/deprecations'
|
3
4
|
|
4
5
|
module ROM
|
5
6
|
# Globally accessible public interface exposed via ROM module
|
@@ -12,6 +13,7 @@ module ROM
|
|
12
13
|
def self.extended(rom)
|
13
14
|
super
|
14
15
|
|
16
|
+
rom.instance_variable_set('@env', nil)
|
15
17
|
rom.instance_variable_set('@adapters', {})
|
16
18
|
rom.instance_variable_set('@plugin_registry', PluginRegistry.new)
|
17
19
|
end
|
@@ -54,5 +56,27 @@ module ROM
|
|
54
56
|
adapters[identifier] = adapter
|
55
57
|
self
|
56
58
|
end
|
59
|
+
|
60
|
+
def env=(container)
|
61
|
+
@env = container
|
62
|
+
end
|
63
|
+
|
64
|
+
def env
|
65
|
+
if @env.nil?
|
66
|
+
ROM::Deprecations.announce(:env, %q{
|
67
|
+
ROM.env is no longer automatically populated with your container.
|
68
|
+
If possible, refactor your code to remove the dependency on global ROM state. If it is not
|
69
|
+
possible—or as a temporary solution—you can assign your container to `ROM.env` upon
|
70
|
+
creation:
|
71
|
+
|
72
|
+
ROM.env = ROM.container(:memory) do |rom|
|
73
|
+
...
|
74
|
+
end
|
75
|
+
})
|
76
|
+
nil
|
77
|
+
else
|
78
|
+
@env
|
79
|
+
end
|
80
|
+
end
|
57
81
|
end
|
58
82
|
end
|
data/lib/rom/lint/spec.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
require 'rom/lint/gateway'
|
2
2
|
require 'rom/lint/enumerable_dataset'
|
3
3
|
|
4
|
-
RSpec.shared_examples "a rom repository" do
|
5
|
-
before(:all) do
|
6
|
-
ROM::Deprecations.announce "[Adapter]::Repository is", <<-MSG
|
7
|
-
Please use [Adapter]::Gateway instead.
|
8
|
-
MSG
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:gateway) { repository }
|
12
|
-
|
13
|
-
include_examples "a rom gateway"
|
14
|
-
end
|
15
|
-
|
16
4
|
RSpec.shared_examples "a rom gateway" do
|
17
5
|
ROM::Lint::Gateway.each_lint do |name, linter|
|
18
6
|
it name do
|
data/lib/rom/lint/test.rb
CHANGED
@@ -61,37 +61,6 @@ module ROM
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
# This is a transitional lint-test loader for repository class
|
65
|
-
# to ensure that the basic interfaces are in place
|
66
|
-
#
|
67
|
-
# class MyRepositoryTest < Minitest::Test
|
68
|
-
# include ROM::Lint::TestRepository
|
69
|
-
#
|
70
|
-
# def setup
|
71
|
-
# @repository = MyRepository
|
72
|
-
# @uri = "super_db://something"
|
73
|
-
# end
|
74
|
-
# end
|
75
|
-
#
|
76
|
-
# @see [ROM::Lint::TestGateway]
|
77
|
-
#
|
78
|
-
# @api public
|
79
|
-
module TestRepository
|
80
|
-
extend TestGateway
|
81
|
-
|
82
|
-
# Returns the reposiotry class
|
83
|
-
#
|
84
|
-
# @api public
|
85
|
-
attr_reader :repository
|
86
|
-
|
87
|
-
def setup
|
88
|
-
ROM::Deprecations.announce "[Adapter]::Repository is", <<-MSG
|
89
|
-
Please use [Adapter]::Gateway instead.
|
90
|
-
MSG
|
91
|
-
@gateway = repository
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
64
|
# This is a simple lint-test for a gateway dataset class to ensure the
|
96
65
|
# basic behavior is correct
|
97
66
|
#
|
data/lib/rom/memory/commands.rb
CHANGED
@@ -14,12 +14,12 @@ module ROM
|
|
14
14
|
|
15
15
|
# @see ROM::Commands::Create#execute
|
16
16
|
def execute(tuples)
|
17
|
-
Array([tuples]).flatten.map
|
17
|
+
Array([tuples]).flatten.map { |tuple|
|
18
18
|
attributes = input[tuple]
|
19
19
|
validator.call(attributes)
|
20
20
|
relation.insert(attributes.to_h)
|
21
21
|
attributes
|
22
|
-
|
22
|
+
}.to_a
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/rom/memory/gateway.rb
CHANGED
data/lib/rom/pipeline.rb
CHANGED
data/lib/rom/plugin_base.rb
CHANGED
data/lib/rom/plugin_registry.rb
CHANGED
@@ -5,12 +5,13 @@ module ROM
|
|
5
5
|
#
|
6
6
|
# @api private
|
7
7
|
class PluginRegistry
|
8
|
-
# Internal registry for
|
8
|
+
# Internal registry for configuration plugins
|
9
9
|
#
|
10
|
-
# @return [
|
10
|
+
# @return [ConfigurationPluginRegistry]
|
11
11
|
#
|
12
12
|
# @api private
|
13
|
-
attr_reader :
|
13
|
+
attr_reader :configuration
|
14
|
+
|
14
15
|
# Internal registry for command plugins
|
15
16
|
#
|
16
17
|
# @return [InternalPluginRegistry]
|
@@ -34,7 +35,7 @@ module ROM
|
|
34
35
|
|
35
36
|
# @api private
|
36
37
|
def initialize
|
37
|
-
@
|
38
|
+
@configuration = ConfigurationPluginRegistry.new
|
38
39
|
@mappers = InternalPluginRegistry.new
|
39
40
|
@commands = InternalPluginRegistry.new
|
40
41
|
@relations = InternalPluginRegistry.new
|
@@ -63,10 +64,10 @@ module ROM
|
|
63
64
|
# @api private
|
64
65
|
def plugins_for(type, adapter)
|
65
66
|
case type
|
66
|
-
when :
|
67
|
-
when :command
|
68
|
-
when :mapper
|
69
|
-
when :relation
|
67
|
+
when :configuration then configuration
|
68
|
+
when :command then commands.adapter(adapter)
|
69
|
+
when :mapper then mappers.adapter(adapter)
|
70
|
+
when :relation then relations.adapter(adapter)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
@@ -88,7 +89,7 @@ module ROM
|
|
88
89
|
# A registry storing environment specific plugins
|
89
90
|
#
|
90
91
|
# @api private
|
91
|
-
class
|
92
|
+
class ConfigurationPluginRegistry < PluginRegistryBase
|
92
93
|
# Assign a plugin to this environment registry
|
93
94
|
#
|
94
95
|
# @param [Symbol] name The registered plugin name
|
@@ -97,8 +98,9 @@ module ROM
|
|
97
98
|
#
|
98
99
|
# @api private
|
99
100
|
def register(name, mod, options)
|
100
|
-
elements[name] =
|
101
|
+
elements[name] = ConfigurationPlugin.new(mod, options)
|
101
102
|
end
|
103
|
+
|
102
104
|
# Return an environment plugin
|
103
105
|
#
|
104
106
|
# @param [Symbol] name The name of the environment plugin
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rom/configuration_dsl'
|
2
|
+
|
3
|
+
module ROM
|
4
|
+
module ConfigurationPlugins
|
5
|
+
# Provides macros for defining relations, mappers and commands
|
6
|
+
#
|
7
|
+
# @api public
|
8
|
+
module ConfigurationDSL
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
def self.apply(configuration, options = {})
|
12
|
+
configuration.extend(ROM::ConfigurationDSL)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ROM
|
2
|
+
module Plugins
|
3
|
+
module Relation
|
4
|
+
module KeyInference
|
5
|
+
# Infer foreign_key name for this relation
|
6
|
+
#
|
7
|
+
# TODO: this should be configurable and handled by an injected policy
|
8
|
+
#
|
9
|
+
# @return [Symbol]
|
10
|
+
#
|
11
|
+
# @api private
|
12
|
+
def foreign_key
|
13
|
+
:"#{Inflector.singularize(name)}_id"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return base name which defaults to name attribute
|
17
|
+
#
|
18
|
+
# @return [Symbol]
|
19
|
+
#
|
20
|
+
# @api private
|
21
|
+
def base_name
|
22
|
+
name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
ROM.plugins do
|
30
|
+
register :key_inference, ROM::Plugins::Relation::KeyInference, type: :relation
|
31
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'rom/plugins/relation/view/dsl'
|
2
|
+
|
3
|
+
module ROM
|
4
|
+
module Plugins
|
5
|
+
module Relation
|
6
|
+
module View
|
7
|
+
def self.included(klass)
|
8
|
+
super
|
9
|
+
|
10
|
+
klass.class_eval do
|
11
|
+
extend ClassInterface
|
12
|
+
|
13
|
+
option :view, reader: true
|
14
|
+
|
15
|
+
def self.attributes
|
16
|
+
@__attributes__ ||= {}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Return column names that will be selected for this relation
|
22
|
+
#
|
23
|
+
# By default we use dataset columns but first we look at configured
|
24
|
+
# attributes by `view` DSL
|
25
|
+
#
|
26
|
+
# @return [Array<Symbol>]
|
27
|
+
#
|
28
|
+
# @api private
|
29
|
+
def attributes(view_name = view)
|
30
|
+
header = self.class.attributes
|
31
|
+
.fetch(view_name, self.class.attributes.fetch(:base))
|
32
|
+
|
33
|
+
if header.is_a?(Proc)
|
34
|
+
instance_exec(&header)
|
35
|
+
else
|
36
|
+
header
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module ClassInterface
|
41
|
+
# Define a relation view with a specific header
|
42
|
+
#
|
43
|
+
# With headers defined all the mappers will be inferred automatically
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# class Users < ROM::Relation[:sql]
|
47
|
+
# view(:by_name, [:id, :name]) do |name|
|
48
|
+
# where(name: name)
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# view(:listing, [:id, :name, :email]) do
|
52
|
+
# select(:id, :name, :email).order(:name)
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# @api public
|
57
|
+
def view(*args, &block)
|
58
|
+
if args.size == 1 && block.arity > 0
|
59
|
+
raise ArgumentError, "header must be set as second argument"
|
60
|
+
end
|
61
|
+
|
62
|
+
name, names, relation_block =
|
63
|
+
if args.size == 1
|
64
|
+
DSL.new(*args, &block).call
|
65
|
+
else
|
66
|
+
[*args, block]
|
67
|
+
end
|
68
|
+
|
69
|
+
attributes[name] = names
|
70
|
+
|
71
|
+
if relation_block.arity > 0
|
72
|
+
auto_curry_guard do
|
73
|
+
define_method(name, &relation_block)
|
74
|
+
auto_curry(name) { with(view: name) }
|
75
|
+
end
|
76
|
+
else
|
77
|
+
define_method(name) do
|
78
|
+
instance_exec(&relation_block).with(view: name)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
ROM.plugins do
|
89
|
+
register :view, ROM::Plugins::Relation::View, type: :relation
|
90
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module ROM
|
2
|
+
module Plugins
|
3
|
+
module Relation
|
4
|
+
module View
|
5
|
+
class DSL
|
6
|
+
attr_reader :name
|
7
|
+
|
8
|
+
attr_reader :attributes
|
9
|
+
|
10
|
+
attr_reader :relation_block
|
11
|
+
|
12
|
+
def initialize(name, &block)
|
13
|
+
@name = name
|
14
|
+
instance_eval(&block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def header(*args, &block)
|
18
|
+
@attributes = args.size > 0 ? args.first : block
|
19
|
+
end
|
20
|
+
|
21
|
+
def relation(&block)
|
22
|
+
@relation_block = lambda(&block)
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
[name, attributes, relation_block]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/rom/relation.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rom/support/deprecations'
|
2
1
|
require 'rom/relation/class_interface'
|
3
2
|
|
4
3
|
require 'rom/pipeline'
|
@@ -26,12 +25,10 @@ module ROM
|
|
26
25
|
#
|
27
26
|
# @api public
|
28
27
|
class Relation
|
29
|
-
extend Deprecations
|
30
28
|
extend ClassInterface
|
31
|
-
extend ROM::Support::GuardedInheritanceHook
|
32
29
|
|
33
30
|
include Options
|
34
|
-
include Equalizer
|
31
|
+
include Dry::Equalizer(:dataset)
|
35
32
|
include Materializable
|
36
33
|
include Pipeline
|
37
34
|
|
@@ -104,13 +101,6 @@ module ROM
|
|
104
101
|
def with(options)
|
105
102
|
__new__(dataset, options)
|
106
103
|
end
|
107
|
-
deprecate :to_lazy, :with, "to_lazy is no longer needed"
|
108
|
-
|
109
|
-
# @api public
|
110
|
-
def relation
|
111
|
-
Deprecations.announce("#relation", 'all relations are now lazy')
|
112
|
-
self
|
113
|
-
end
|
114
104
|
|
115
105
|
private
|
116
106
|
|