rom 1.0.0 → 2.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 +4 -4
- data/.rspec +1 -1
- data/.travis.yml +5 -3
- data/CHANGELOG.md +38 -0
- data/Gemfile +2 -14
- data/README.md +11 -17
- data/lib/rom.rb +2 -0
- data/lib/rom/association_set.rb +26 -0
- data/lib/rom/command.rb +50 -45
- data/lib/rom/command_registry.rb +26 -3
- data/lib/rom/commands/class_interface.rb +52 -19
- data/lib/rom/commands/composite.rb +5 -0
- data/lib/rom/commands/delete.rb +1 -5
- data/lib/rom/commands/graph.rb +11 -0
- data/lib/rom/commands/lazy.rb +2 -0
- data/lib/rom/commands/update.rb +1 -5
- data/lib/rom/configuration.rb +2 -0
- data/lib/rom/container.rb +3 -3
- data/lib/rom/global.rb +1 -23
- data/lib/rom/memory/commands.rb +2 -0
- data/lib/rom/memory/relation.rb +3 -0
- data/lib/rom/memory/storage.rb +4 -7
- data/lib/rom/memory/types.rb +9 -0
- data/lib/rom/pipeline.rb +26 -12
- data/lib/rom/plugin_registry.rb +2 -2
- data/lib/rom/plugins/command/schema.rb +26 -0
- data/lib/rom/plugins/configuration/configuration_dsl.rb +2 -1
- data/lib/rom/plugins/relation/key_inference.rb +18 -3
- data/lib/rom/plugins/relation/registry_reader.rb +3 -1
- data/lib/rom/plugins/relation/view.rb +11 -6
- data/lib/rom/relation.rb +76 -16
- data/lib/rom/relation/class_interface.rb +44 -3
- data/lib/rom/relation/curried.rb +13 -4
- data/lib/rom/relation/graph.rb +15 -5
- data/lib/rom/relation/loaded.rb +42 -6
- data/lib/rom/relation/name.rb +102 -0
- data/lib/rom/relation_registry.rb +5 -0
- data/lib/rom/schema.rb +87 -0
- data/lib/rom/schema/dsl.rb +58 -0
- data/lib/rom/setup/auto_registration.rb +2 -2
- data/lib/rom/setup/finalize.rb +5 -5
- data/lib/rom/setup/finalize/{commands.rb → finalize_commands.rb} +2 -22
- data/lib/rom/setup/finalize/{mappers.rb → finalize_mappers.rb} +0 -0
- data/lib/rom/setup/finalize/finalize_relations.rb +60 -0
- data/lib/rom/types.rb +18 -0
- data/lib/rom/version.rb +1 -1
- data/log/.gitkeep +0 -0
- data/rom.gemspec +4 -2
- data/spec/integration/command_registry_spec.rb +13 -0
- data/spec/integration/commands/delete_spec.rb +0 -17
- data/spec/integration/commands/graph_builder_spec.rb +1 -1
- data/spec/integration/commands/graph_spec.rb +1 -1
- data/spec/integration/commands/update_spec.rb +0 -19
- data/spec/integration/commands_spec.rb +10 -3
- data/spec/integration/multi_repo_spec.rb +1 -1
- data/spec/integration/relations/default_dataset_spec.rb +27 -4
- data/spec/integration/setup_spec.rb +1 -4
- data/spec/shared/command_behavior.rb +17 -7
- data/spec/shared/container.rb +2 -2
- data/spec/shared/gateway_only.rb +1 -1
- data/spec/spec_helper.rb +5 -6
- data/spec/unit/rom/association_set_spec.rb +23 -0
- data/spec/unit/rom/auto_registration_spec.rb +1 -1
- data/spec/unit/rom/commands/lazy_spec.rb +8 -0
- data/spec/unit/rom/commands_spec.rb +45 -7
- data/spec/unit/rom/configurable_spec.rb +1 -1
- data/spec/unit/rom/container_spec.rb +6 -0
- data/spec/unit/rom/create_container_spec.rb +1 -1
- data/spec/unit/rom/environment_spec.rb +1 -1
- data/spec/unit/rom/memory/commands_spec.rb +43 -0
- data/spec/unit/rom/plugins/relation/key_inference_spec.rb +70 -12
- data/spec/unit/rom/plugins/relation/view_spec.rb +4 -0
- data/spec/unit/rom/relation/graph_spec.rb +10 -0
- data/spec/unit/rom/relation/lazy_spec.rb +3 -3
- data/spec/unit/rom/relation/loaded_spec.rb +15 -0
- data/spec/unit/rom/relation/name_spec.rb +51 -0
- data/spec/unit/rom/relation/schema_spec.rb +117 -0
- data/spec/unit/rom/relation_spec.rb +37 -7
- data/spec/unit/rom/schema_spec.rb +10 -0
- metadata +51 -12
- data/lib/rom/setup/finalize/relations.rb +0 -53
- data/spec/unit/rom/global_spec.rb +0 -18
- data/spec/unit/rom/registry_spec.rb +0 -38
@@ -3,25 +3,83 @@ require 'rom/memory'
|
|
3
3
|
require 'rom/plugins/relation/key_inference'
|
4
4
|
|
5
5
|
RSpec.describe ROM::Plugins::Relation::KeyInference do
|
6
|
-
subject(:relation)
|
6
|
+
subject(:relation) do
|
7
|
+
relation_class.new(
|
8
|
+
[],
|
9
|
+
__registry__: ROM::RelationRegistry.new(posts: posts, users: users, tags: tags)
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:posts) { double(foreign_key: :post_id) }
|
14
|
+
let(:tags_name) { ROM::Relation::Name[:tags] }
|
15
|
+
let(:tags) { double(foreign_key: :tag_id) }
|
16
|
+
let(:users_name) { ROM::Relation::Name[:users] }
|
17
|
+
let(:users) { double(base_name: users_name) }
|
7
18
|
|
8
|
-
|
9
|
-
|
10
|
-
|
19
|
+
describe 'without a schema' do
|
20
|
+
let(:relation_class) do
|
21
|
+
Class.new(ROM::Memory::Relation) do
|
22
|
+
use :key_inference
|
11
23
|
|
12
|
-
|
24
|
+
dataset :users
|
25
|
+
end
|
13
26
|
end
|
14
|
-
end
|
15
27
|
|
16
|
-
|
17
|
-
|
18
|
-
|
28
|
+
describe '#base_name' do
|
29
|
+
it 'returns dataset name by default' do
|
30
|
+
expect(relation.base_name).to eql(ROM::Relation::Name[:users])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#foreign_key' do
|
35
|
+
it 'returns default value' do
|
36
|
+
expect(relation.foreign_key).to be(:user_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns default value for another relation' do
|
40
|
+
expect(relation.foreign_key(:posts)).to be(:post_id)
|
41
|
+
expect(relation.foreign_key(posts)).to be(:post_id)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns default value for Relation::Name' do
|
45
|
+
expect(relation.foreign_key(ROM::Relation::Name[:posts])).to be(:post_id)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'supports objects responding to to_sym' do
|
49
|
+
external_name = double(to_sym: :tags)
|
50
|
+
expect(relation.foreign_key(external_name)).to be(:tag_id)
|
51
|
+
end
|
19
52
|
end
|
20
53
|
end
|
21
54
|
|
22
|
-
describe '
|
23
|
-
|
24
|
-
|
55
|
+
describe 'with a schema' do
|
56
|
+
let(:relation_class) do
|
57
|
+
Class.new(ROM::Memory::Relation) do
|
58
|
+
use :key_inference
|
59
|
+
|
60
|
+
schema :posts do
|
61
|
+
attribute :author_id, ROM::Types::Int.meta(foreign_key: true, relation: :users)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#foreign_key' do
|
67
|
+
it 'returns configured value' do
|
68
|
+
expect(relation.foreign_key(ROM::Relation::Name[:users])).to be(:author_id)
|
69
|
+
expect(relation.foreign_key(:users)).to be(:author_id)
|
70
|
+
expect(relation.foreign_key(users)).to be(:author_id)
|
71
|
+
expect(relation.foreign_key(users_name)).to be(:author_id)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'falls back to default when schema has no fk specified' do
|
75
|
+
expect(relation.foreign_key(:tags)).to be(:tag_id)
|
76
|
+
expect(relation.foreign_key(tags_name)).to be(:tag_id)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'supports objects responding to to_sym' do
|
80
|
+
external_name = double(to_sym: :tags)
|
81
|
+
expect(relation.foreign_key(external_name)).to be(:tag_id)
|
82
|
+
end
|
25
83
|
end
|
26
84
|
end
|
27
85
|
end
|
@@ -43,5 +43,9 @@ RSpec.describe ROM::Plugins::Relation::View do
|
|
43
43
|
it 'returns correct arity for a curried view' do
|
44
44
|
expect(relation.names.arity).to be(1)
|
45
45
|
end
|
46
|
+
|
47
|
+
it 'returns explicitly set attributes' do
|
48
|
+
expect(relation.with(attributes: [:foo, :bar]).attributes).to eql([:foo, :bar])
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
@@ -22,6 +22,16 @@ describe ROM::Relation::Graph do
|
|
22
22
|
|
23
23
|
subject(:graph) { ROM::Relation::Graph.new(users_relation, [tasks_relation.for_users]) }
|
24
24
|
|
25
|
+
describe '#graph?' do
|
26
|
+
it 'returns true' do
|
27
|
+
expect(graph.graph?).to be(true)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns true when curried' do
|
31
|
+
expect(graph.by_name.graph?).to be(true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
25
35
|
it_behaves_like 'materializable relation' do
|
26
36
|
let(:mapper) do
|
27
37
|
T(:combine, [[:tasks, name: :name]])
|
@@ -61,12 +61,12 @@ describe ROM::Relation do
|
|
61
61
|
it 'forwards to relation and auto-curries' do
|
62
62
|
relation = users_relation.by_name_and_email_sorted('Jane')
|
63
63
|
|
64
|
-
expect(relation.name).to eql(:by_name_and_email_sorted)
|
64
|
+
expect(relation.name).to eql(ROM::Relation::Name[:by_name_and_email_sorted])
|
65
65
|
expect(relation.curry_args).to eql(['Jane'])
|
66
66
|
|
67
67
|
relation = relation['jane@doe.org']
|
68
68
|
|
69
|
-
expect(relation.name).to eql(:by_name_and_email_sorted)
|
69
|
+
expect(relation.name).to eql(ROM::Relation::Name[:by_name_and_email_sorted])
|
70
70
|
expect(relation.curry_args).to eql(['Jane', 'jane@doe.org'])
|
71
71
|
|
72
72
|
expect(relation[:email]).to match_array(
|
@@ -100,7 +100,7 @@ describe ROM::Relation do
|
|
100
100
|
it 'auto-curries' do
|
101
101
|
relation = users_relation.by_name
|
102
102
|
|
103
|
-
expect(relation.name).to eql(:by_name)
|
103
|
+
expect(relation.name).to eql(ROM::Relation::Name[:by_name])
|
104
104
|
expect(relation['Jane'].to_a).to eql(users_relation.by_name('Jane').to_a)
|
105
105
|
end
|
106
106
|
|
@@ -9,9 +9,11 @@ describe ROM::Relation::Loaded do
|
|
9
9
|
describe '#each' do
|
10
10
|
it 'yields tuples from relation' do
|
11
11
|
result = []
|
12
|
+
|
12
13
|
users.each do |tuple|
|
13
14
|
result << tuple
|
14
15
|
end
|
16
|
+
|
15
17
|
expect(result).to match_array([
|
16
18
|
{ name: 'Jane', email: 'jane@doe.org' },
|
17
19
|
{ name: 'Joe', email: 'joe@doe.org' }
|
@@ -32,6 +34,19 @@ describe ROM::Relation::Loaded do
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
37
|
+
describe '#pluck' do
|
38
|
+
it 'returns a list of values under provided key' do
|
39
|
+
expect(users.pluck(:email)).to eql(%w(joe@doe.org jane@doe.org))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#primary_keys' do
|
44
|
+
it 'returns a list of primary key values' do
|
45
|
+
expect(users.source).to receive(:primary_key).and_return(:name)
|
46
|
+
expect(users.primary_keys).to eql(%w(Joe Jane))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
35
50
|
it_behaves_like 'a relation that returns one tuple' do
|
36
51
|
let(:relation) { users }
|
37
52
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rom/relation/name'
|
2
|
+
|
3
|
+
RSpec.describe ROM::Relation::Name do
|
4
|
+
describe '.[]' do
|
5
|
+
it 'returns a new name from args' do
|
6
|
+
expect(ROM::Relation::Name[:users]).to eql(
|
7
|
+
ROM::Relation::Name.new(:users)
|
8
|
+
)
|
9
|
+
|
10
|
+
expect(ROM::Relation::Name[:authors, :users]).to eql(
|
11
|
+
ROM::Relation::Name.new(:authors, :users)
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns name object when it was passed in as arg' do
|
16
|
+
name = ROM::Relation::Name[:users]
|
17
|
+
expect(ROM::Relation::Name[name]).to be(name)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'caches name instances' do
|
21
|
+
name = ROM::Relation::Name[:users]
|
22
|
+
expect(ROM::Relation::Name[:users]).to be(name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#inspect' do
|
27
|
+
it 'provides relation name' do
|
28
|
+
name = ROM::Relation::Name.new(:users)
|
29
|
+
expect(name.inspect).to eql("ROM::Relation::Name(users)")
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'provides dataset and relation names' do
|
33
|
+
name = ROM::Relation::Name.new(:authors, :users)
|
34
|
+
expect(name.inspect).to eql("ROM::Relation::Name(authors on users)")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#with' do
|
39
|
+
it 'returns a new name with the same dataset but for a different relation name' do
|
40
|
+
name = ROM::Relation::Name[:users]
|
41
|
+
expect(name.with(:people)).to be(ROM::Relation::Name[:people, :users])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#to_sym' do
|
46
|
+
it 'returns relation name' do
|
47
|
+
expect(ROM::Relation::Name.new(:users).to_sym).to be(:users)
|
48
|
+
expect(ROM::Relation::Name.new(:authors, :users).to_sym).to be(:authors)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rom/memory'
|
3
|
+
|
4
|
+
describe ROM::Relation, '.schema' do
|
5
|
+
it 'defines a canonical schema for a relation' do
|
6
|
+
class Test::Users < ROM::Relation[:memory]
|
7
|
+
schema do
|
8
|
+
attribute :id, Types::Int.meta(primary_key: true)
|
9
|
+
attribute :name, Types::String
|
10
|
+
attribute :admin, Types::Bool
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Test::Users.schema.finalize!
|
15
|
+
|
16
|
+
schema = ROM::Schema.new(
|
17
|
+
ROM::Relation::Name.new(:test_users),
|
18
|
+
id: ROM::Memory::Types::Int.meta(primary_key: true, name: :id),
|
19
|
+
name: ROM::Memory::Types::String.meta(name: :name),
|
20
|
+
admin: ROM::Memory::Types::Bool.meta(name: :admin)
|
21
|
+
).finalize!
|
22
|
+
|
23
|
+
expect(Test::Users.schema.primary_key).to eql([Test::Users.schema[:id]])
|
24
|
+
|
25
|
+
expect(Test::Users.schema).to eql(schema)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'allows setting composite primary key' do
|
29
|
+
class Test::Users < ROM::Relation[:memory]
|
30
|
+
schema do
|
31
|
+
attribute :name, Types::String
|
32
|
+
attribute :email, Types::String
|
33
|
+
|
34
|
+
primary_key :name, :email
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
schema = Test::Users.schema.finalize!
|
39
|
+
|
40
|
+
expect(schema.primary_key).to eql([schema[:name], schema[:email]])
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'allows setting foreign keys' do
|
44
|
+
class Test::Posts < ROM::Relation[:memory]
|
45
|
+
schema do
|
46
|
+
attribute :author_id, Types::ForeignKey(:users)
|
47
|
+
attribute :title, Types::String
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
schema = Test::Posts.schema
|
52
|
+
|
53
|
+
expect(schema[:author_id].primitive).to be(Integer)
|
54
|
+
|
55
|
+
expect(schema.foreign_key(:users)).to be(schema[:author_id])
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'sets register_as and dataset' do
|
59
|
+
class Test::Users < ROM::Relation[:memory]
|
60
|
+
schema(:users) do
|
61
|
+
attribute :id, Types::Int
|
62
|
+
attribute :name, Types::String
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
expect(Test::Users.dataset).to be(:users)
|
67
|
+
expect(Test::Users.register_as).to be(:users)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'sets dataset and respects custom register_as' do
|
71
|
+
class Test::Users < ROM::Relation[:memory]
|
72
|
+
register_as :test_users
|
73
|
+
|
74
|
+
schema(:users) do
|
75
|
+
attribute :id, Types::Int
|
76
|
+
attribute :name, Types::String
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
expect(Test::Users.dataset).to be(:users)
|
81
|
+
expect(Test::Users.register_as).to be(:test_users)
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#schema' do
|
85
|
+
it 'returns defined schema' do
|
86
|
+
class Test::Users < ROM::Relation[:memory]
|
87
|
+
schema do
|
88
|
+
attribute :id, Types::Int.meta(primary_key: true)
|
89
|
+
attribute :name, Types::String
|
90
|
+
attribute :admin, Types::Bool
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
users = Test::Users.new([])
|
95
|
+
|
96
|
+
expect(users.schema).to be(Test::Users.schema)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'uses custom schema dsl' do
|
100
|
+
class Test::SchemaDSL < ROM::Schema::DSL
|
101
|
+
def bool(name)
|
102
|
+
attribute(name, ::ROM::Types::Bool)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class Test::Users < ROM::Relation[:memory]
|
107
|
+
schema_dsl Test::SchemaDSL
|
108
|
+
|
109
|
+
schema do
|
110
|
+
bool :admin
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
expect(Test::Users.schema[:admin]).to eql(ROM::Types::Bool.meta(name: :admin))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
1
|
require 'rom/memory'
|
3
2
|
|
4
3
|
describe ROM::Relation do
|
@@ -126,7 +125,7 @@ describe ROM::Relation do
|
|
126
125
|
it 'returns name based on module and class' do
|
127
126
|
relation = Test::Test::SuperRelation.new([])
|
128
127
|
|
129
|
-
expect(relation.name).to
|
128
|
+
expect(relation.name).to eql(ROM::Relation::Name.new(:test_test_super_relation))
|
130
129
|
end
|
131
130
|
end
|
132
131
|
|
@@ -138,7 +137,7 @@ describe ROM::Relation do
|
|
138
137
|
it 'returns name based only on class' do
|
139
138
|
relation = Test::SuperRelation.new([])
|
140
139
|
|
141
|
-
expect(relation.name).to
|
140
|
+
expect(relation.name).to eql(ROM::Relation::Name.new(:test_super_relation))
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
@@ -151,7 +150,7 @@ describe ROM::Relation do
|
|
151
150
|
it 'inherits :name from the super relation' do
|
152
151
|
relation = Test::DescendantRelation.new([])
|
153
152
|
|
154
|
-
expect(relation.name).to eql(:test_super_relation)
|
153
|
+
expect(relation.name).to eql(ROM::Relation::Name.new(:test_super_relation))
|
155
154
|
end
|
156
155
|
end
|
157
156
|
end
|
@@ -168,7 +167,7 @@ describe ROM::Relation do
|
|
168
167
|
it 'returns name based on dataset' do
|
169
168
|
relation = Test::TestAdapter::Relation.new([])
|
170
169
|
|
171
|
-
expect(relation.name).to
|
170
|
+
expect(relation.name).to eql(ROM::Relation::Name.new(:foo_bar))
|
172
171
|
end
|
173
172
|
end
|
174
173
|
end
|
@@ -197,11 +196,42 @@ describe ROM::Relation do
|
|
197
196
|
|
198
197
|
describe "#with" do
|
199
198
|
it "returns a new instance with the original dataset and given custom options" do
|
199
|
+
relation = Class.new(ROM::Relation) { option :custom }.new([])
|
200
|
+
|
200
201
|
custom_opts = { mappers: "Custom Mapper Registry" }
|
201
|
-
new_relation = relation.with(custom_opts)
|
202
|
+
new_relation = relation.with(custom_opts).with(custom: true)
|
202
203
|
|
203
204
|
expect(new_relation.dataset).to be(relation.dataset)
|
204
|
-
expect(new_relation.options).to include(custom_opts)
|
205
|
+
expect(new_relation.options).to include(custom_opts.merge(custom: true))
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
describe '#graph?' do
|
210
|
+
it 'returns false' do
|
211
|
+
expect(relation.graph?).to be(false)
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'returns false when curried' do
|
215
|
+
relation = Class.new(ROM::Relation[:memory]) { def by_name(_); self; end }.new([])
|
216
|
+
expect(relation.by_name.graph?).to be(false)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe '#schema_hash' do
|
221
|
+
it 'returns a schema hash type' do
|
222
|
+
relation = Class.new(ROM::Relation[:memory]) do
|
223
|
+
schema { attribute :id, ROM::Types::Coercible::Int }
|
224
|
+
end.new([])
|
225
|
+
|
226
|
+
expect(relation.schema_hash[id: '1']).to eql(id: 1)
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'returns a plain Hash coercer when there is no schema' do
|
230
|
+
relation = Class.new(ROM::Relation[:memory]).new([])
|
231
|
+
|
232
|
+
tuple = [[:id, '1']]
|
233
|
+
|
234
|
+
expect(relation.schema_hash[tuple]).to eql(id: '1')
|
205
235
|
end
|
206
236
|
end
|
207
237
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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: 2016-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: dry-equalizer
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,34 +38,48 @@ dependencies:
|
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dry-types
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.8'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.8'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rom-support
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
59
|
- - "~>"
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
61
|
+
version: '2.0'
|
34
62
|
type: :runtime
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
68
|
+
version: '2.0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: rom-mapper
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
75
|
+
version: 0.4.0
|
48
76
|
type: :runtime
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
82
|
+
version: 0.4.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +128,7 @@ files:
|
|
100
128
|
- README.md
|
101
129
|
- Rakefile
|
102
130
|
- lib/rom.rb
|
131
|
+
- lib/rom/association_set.rb
|
103
132
|
- lib/rom/command.rb
|
104
133
|
- lib/rom/command_registry.rb
|
105
134
|
- lib/rom/commands.rb
|
@@ -144,10 +173,12 @@ files:
|
|
144
173
|
- lib/rom/memory/gateway.rb
|
145
174
|
- lib/rom/memory/relation.rb
|
146
175
|
- lib/rom/memory/storage.rb
|
176
|
+
- lib/rom/memory/types.rb
|
147
177
|
- lib/rom/pipeline.rb
|
148
178
|
- lib/rom/plugin.rb
|
149
179
|
- lib/rom/plugin_base.rb
|
150
180
|
- lib/rom/plugin_registry.rb
|
181
|
+
- lib/rom/plugins/command/schema.rb
|
151
182
|
- lib/rom/plugins/configuration/configuration_dsl.rb
|
152
183
|
- lib/rom/plugins/relation/key_inference.rb
|
153
184
|
- lib/rom/plugins/relation/registry_reader.rb
|
@@ -160,15 +191,20 @@ files:
|
|
160
191
|
- lib/rom/relation/graph.rb
|
161
192
|
- lib/rom/relation/loaded.rb
|
162
193
|
- lib/rom/relation/materializable.rb
|
194
|
+
- lib/rom/relation/name.rb
|
163
195
|
- lib/rom/relation_registry.rb
|
196
|
+
- lib/rom/schema.rb
|
197
|
+
- lib/rom/schema/dsl.rb
|
164
198
|
- lib/rom/setup.rb
|
165
199
|
- lib/rom/setup/auto_registration.rb
|
166
200
|
- lib/rom/setup/finalize.rb
|
167
|
-
- lib/rom/setup/finalize/
|
168
|
-
- lib/rom/setup/finalize/
|
169
|
-
- lib/rom/setup/finalize/
|
201
|
+
- lib/rom/setup/finalize/finalize_commands.rb
|
202
|
+
- lib/rom/setup/finalize/finalize_mappers.rb
|
203
|
+
- lib/rom/setup/finalize/finalize_relations.rb
|
170
204
|
- lib/rom/support/configurable.rb
|
205
|
+
- lib/rom/types.rb
|
171
206
|
- lib/rom/version.rb
|
207
|
+
- log/.gitkeep
|
172
208
|
- rakelib/benchmark.rake
|
173
209
|
- rakelib/mutant.rake
|
174
210
|
- rakelib/rubocop.rake
|
@@ -233,6 +269,7 @@ files:
|
|
233
269
|
- spec/support/constant_leak_finder.rb
|
234
270
|
- spec/support/mutant.rb
|
235
271
|
- spec/test/memory_repository_lint_test.rb
|
272
|
+
- spec/unit/rom/association_set_spec.rb
|
236
273
|
- spec/unit/rom/auto_registration_spec.rb
|
237
274
|
- spec/unit/rom/commands/graph_spec.rb
|
238
275
|
- spec/unit/rom/commands/lazy_spec.rb
|
@@ -244,8 +281,8 @@ files:
|
|
244
281
|
- spec/unit/rom/create_container_spec.rb
|
245
282
|
- spec/unit/rom/environment_spec.rb
|
246
283
|
- spec/unit/rom/gateway_spec.rb
|
247
|
-
- spec/unit/rom/global_spec.rb
|
248
284
|
- spec/unit/rom/mapper_registry_spec.rb
|
285
|
+
- spec/unit/rom/memory/commands_spec.rb
|
249
286
|
- spec/unit/rom/memory/dataset_spec.rb
|
250
287
|
- spec/unit/rom/memory/relation_spec.rb
|
251
288
|
- spec/unit/rom/memory/repository_spec.rb
|
@@ -253,14 +290,16 @@ files:
|
|
253
290
|
- spec/unit/rom/plugin_spec.rb
|
254
291
|
- spec/unit/rom/plugins/relation/key_inference_spec.rb
|
255
292
|
- spec/unit/rom/plugins/relation/view_spec.rb
|
256
|
-
- spec/unit/rom/registry_spec.rb
|
257
293
|
- spec/unit/rom/relation/composite_spec.rb
|
258
294
|
- spec/unit/rom/relation/curried_spec.rb
|
259
295
|
- spec/unit/rom/relation/graph_spec.rb
|
260
296
|
- spec/unit/rom/relation/lazy/combine_spec.rb
|
261
297
|
- spec/unit/rom/relation/lazy_spec.rb
|
262
298
|
- spec/unit/rom/relation/loaded_spec.rb
|
299
|
+
- spec/unit/rom/relation/name_spec.rb
|
300
|
+
- spec/unit/rom/relation/schema_spec.rb
|
263
301
|
- spec/unit/rom/relation_spec.rb
|
302
|
+
- spec/unit/rom/schema_spec.rb
|
264
303
|
homepage: http://rom-rb.org
|
265
304
|
licenses:
|
266
305
|
- MIT
|
@@ -281,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
320
|
version: '0'
|
282
321
|
requirements: []
|
283
322
|
rubyforge_project:
|
284
|
-
rubygems_version: 2.
|
323
|
+
rubygems_version: 2.5.1
|
285
324
|
signing_key:
|
286
325
|
specification_version: 4
|
287
326
|
summary: Ruby Object Mapper
|