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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5827809fbc98f7ff12dcab61273ac7df59a68e71
4
- data.tar.gz: 2b3e041c27dbdaccb320c7696be119bb73dd52f2
3
+ metadata.gz: 4ddd25f7645a1099f8d52290266af25994908fc5
4
+ data.tar.gz: 350a8ddd28bf0e82e88150be053437f5f18e9d27
5
5
  SHA512:
6
- metadata.gz: c4bfb63202fc6817d44f1ff7df626b3ca78c1e7c1d5185d4e507d7e2761821a29cc81129c4d8b691fed469e5c5995a502e318e3a3f7128c680595bbf560a2d2a
7
- data.tar.gz: 444d7a536adc80a5a75cec8c71467faa393210046e741c1075b8f3482f6f3a4d9d69d843128756eb3b9bc455a856019645c97812bc81008b5dc7e8b562fa8e7a
6
+ metadata.gz: 624fdd200b83aeaceca5ea04fd4d11db18622ad21067fe05625492d2561f95841dafaef94a38798a4f09c4f50e3d56b18fc804e357a890ec97b5574e344dbda2
7
+ data.tar.gz: fed37a0fd1b775d710b1c71d47a2ff9952353a5fc347ae0f59251271d70fee4cda97c3ecafaec9c112ede2317ce8c8c98d9e3db69267e6aa4d016de2a1ca74a6
@@ -9,9 +9,8 @@ module Dao
9
9
  @with = []
10
10
  end
11
11
 
12
- def method_missing(method_name, *args, **options, &block)
13
- with = extract_relations(options)
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 extract_relations(options)
49
- if options[:with]
50
- Array([options.delete(:with)]).flatten.compact
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
@@ -1,5 +1,5 @@
1
1
  module Dao
2
2
  module Repository
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  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.0
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-08-02 00:00:00.000000000 Z
12
+ date: 2016-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dao-gateway