realm-rom 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/realm/rom/default_repository_queries.rb +23 -0
- data/lib/realm/rom/repository.rb +14 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bbd13a93d708255528c5eb107619997d0a13b9a937b1c1529d22b14bc4b34e4
|
4
|
+
data.tar.gz: 5cd03d141b3d68feb3b8eadd81b43d80f103814835d3cc0d3aad28e6282bcdb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9043d3d7debe87e938dcc7a5bbf374f407a349d70f23db5b1d295843917a8d5e1a3abd1f464a853e50ae7340b98be03a97494f2a339fe2369d604fa24b01fca
|
7
|
+
data.tar.gz: 96d3764b58af1ba4a3a0e10da4f6c33b792eba650d668d5d97093e9429e67259da5da83c62258528a4249d188096a8d0b8ac3fc99b2d6dc9f6a8159418c95a2f
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Realm
|
4
|
+
module ROM
|
5
|
+
module DefaultRepositoryQueries
|
6
|
+
def find(id = nil, **conditions)
|
7
|
+
root.where({ id: id, **conditions }.compact).one!
|
8
|
+
end
|
9
|
+
|
10
|
+
def first(conditions = {})
|
11
|
+
root.where(conditions).first
|
12
|
+
end
|
13
|
+
|
14
|
+
def last(conditions = {})
|
15
|
+
root.where(conditions).last
|
16
|
+
end
|
17
|
+
|
18
|
+
def all(conditions = {})
|
19
|
+
root.where(conditions).to_a
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/realm/rom/repository.rb
CHANGED
@@ -23,14 +23,21 @@ module Realm
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
class << self
|
27
|
+
def new(*)
|
28
|
+
Isolated.new(super)
|
29
|
+
end
|
30
|
+
|
31
|
+
def repo_name(value = :not_provided)
|
32
|
+
@repo_name = value.to_sym unless value == :not_provided
|
33
|
+
@repo_name ||= name.demodulize.underscore
|
34
|
+
end
|
35
|
+
|
36
|
+
def queries(type)
|
37
|
+
raise 'Only default queries are supported for now' unless type == :default
|
29
38
|
|
30
|
-
|
31
|
-
|
32
|
-
@repo_name = name.demodulize.underscore unless defined?(@repo_name)
|
33
|
-
@repo_name
|
39
|
+
include DefaultRepositoryQueries
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
def readonly
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realm-rom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- developers@reevoo.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: realm-core
|
@@ -157,6 +157,7 @@ extensions: []
|
|
157
157
|
extra_rdoc_files: []
|
158
158
|
files:
|
159
159
|
- lib/realm-rom.rb
|
160
|
+
- lib/realm/rom/default_repository_queries.rb
|
160
161
|
- lib/realm/rom/gateway.rb
|
161
162
|
- lib/realm/rom/plugin.rb
|
162
163
|
- lib/realm/rom/rake_tasks.rb
|