dao-repository 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dao/repository/scope.rb +21 -6
- data/lib/dao/repository/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ddd25f7645a1099f8d52290266af25994908fc5
|
4
|
+
data.tar.gz: 350a8ddd28bf0e82e88150be053437f5f18e9d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 624fdd200b83aeaceca5ea04fd4d11db18622ad21067fe05625492d2561f95841dafaef94a38798a4f09c4f50e3d56b18fc804e357a890ec97b5574e344dbda2
|
7
|
+
data.tar.gz: fed37a0fd1b775d710b1c71d47a2ff9952353a5fc347ae0f59251271d70fee4cda97c3ecafaec9c112ede2317ce8c8c98d9e3db69267e6aa4d016de2a1ca74a6
|
data/lib/dao/repository/scope.rb
CHANGED
@@ -9,9 +9,8 @@ module Dao
|
|
9
9
|
@with = []
|
10
10
|
end
|
11
11
|
|
12
|
-
def method_missing(method_name, *args,
|
13
|
-
with =
|
14
|
-
args << options if options.any?
|
12
|
+
def method_missing(method_name, *args, &block)
|
13
|
+
with = extract_with(args)
|
15
14
|
|
16
15
|
add_relations(with) if with.any?
|
17
16
|
|
@@ -45,13 +44,29 @@ module Dao
|
|
45
44
|
scope.respond_to?(method_name, include_private) || super
|
46
45
|
end
|
47
46
|
|
48
|
-
def
|
49
|
-
if
|
50
|
-
|
47
|
+
def extract_with(args)
|
48
|
+
if have_with_option?(args)
|
49
|
+
with = extract_with_option(args)
|
50
|
+
|
51
|
+
Array([with]).flatten.compact
|
51
52
|
else
|
52
53
|
[]
|
53
54
|
end
|
54
55
|
end
|
56
|
+
|
57
|
+
def have_with_option?(args)
|
58
|
+
options = args.last
|
59
|
+
|
60
|
+
options.is_a?(Hash) && options[:with]
|
61
|
+
end
|
62
|
+
|
63
|
+
def extract_with_option(args)
|
64
|
+
options = args.pop
|
65
|
+
|
66
|
+
options.delete(:with).tap do
|
67
|
+
args << options unless options.empty?
|
68
|
+
end
|
69
|
+
end
|
55
70
|
end
|
56
71
|
end
|
57
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao-repository
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- llxff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dao-gateway
|