rom 3.0.2 → 3.0.3

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: e937480122a0f25c272a123788205fca636c3914
4
- data.tar.gz: 14f714ced390387ee4e3008c6ac7028ec3ffb342
3
+ metadata.gz: 21823f588a092ca791957a4d3bdb1ca3a78fed7e
4
+ data.tar.gz: b779976efe0eb2d4ec2e7af273cd67782def6120
5
5
  SHA512:
6
- metadata.gz: f88ca6fd4d17cce1332c5005f422e4b8fbbfa86e4acd72e602b89322b1a35f22ab8a176fa1dd5e497de78e32432e133b6cc9ba8e08b9d4ac6bf54e65dd0feccd
7
- data.tar.gz: b2e112e5baaa3d27b035ef18143b81576c1a86fda420e2ad8d96e350f4b7ad7a8328f03c8edc12b6b1f927af3d9d1f3d210eb048c7c5e5733c08a67d466c8b0c
6
+ metadata.gz: e5f1e53320f6da430fed29b9c0619847c47b6e34808445852c362216a04a5354384af47b07b946410aa4fbd51c4925f753ef372c9d1485454c00337fc5ff973f
7
+ data.tar.gz: 610cc7feec934fb6550b371218d5ebbc901417bfcd25b7d1d6709f8ef91684435b16b4d1da5d5e5405284ed14d0ad8a968a1e0f61e5d30582b17a0afea17d098
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v3.0.3 2017-02-24
2
+
3
+ ## Fixed
4
+
5
+ * Curried relations when called without args while having some args filled in will return itself (solnic)
6
+
7
+ [Compare v3.0.2...v3.0.3](https://github.com/rom-rb/rom/compare/v3.0.2...v3.0.3)
8
+
1
9
  # v3.0.2 2017-02-24
2
10
 
3
11
  ## Added
@@ -6,6 +14,7 @@
6
14
 
7
15
  ## Fixed
8
16
 
17
+ * Fix output_schema to use Attribute#key rather than canonical names (solnic)
9
18
  * Fix the error message for missing association (flash-gordon)
10
19
  * Curried relation called without any arguments will raise an ArgumentError (solnic)
11
20
 
@@ -28,18 +28,21 @@ module ROM
28
28
 
29
29
  # Load relation if args match the arity
30
30
  #
31
- # @return [Loaded,Lazy,Curried]
32
- # @see Lazy#call
31
+ # @return [Loaded,Curried]
33
32
  #
34
33
  # @api public
35
34
  def call(*args)
36
35
  if arity != -1
37
36
  all_args = curry_args + args
38
37
 
39
- if arity == all_args.size
40
- Loaded.new(relation.__send__(name.relation, *all_args))
41
- elsif args.empty?
38
+ if all_args.empty?
42
39
  raise ArgumentError, "curried #{relation.class}##{name.to_sym} relation was called without any arguments"
40
+ end
41
+
42
+ if args.empty?
43
+ self
44
+ elsif arity == all_args.size
45
+ Loaded.new(relation.__send__(name.relation, *all_args))
43
46
  else
44
47
  __new__(relation, curry_args: all_args)
45
48
  end
data/lib/rom/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ROM
2
- VERSION = '3.0.2'.freeze
2
+ VERSION = '3.0.3'.freeze
3
3
  end
@@ -10,6 +10,10 @@ RSpec.describe ROM::Relation::Curried do
10
10
  restrict(name: name)
11
11
  end
12
12
 
13
+ def by_name_and_age(name, age)
14
+ restrict(name: name, age: age)
15
+ end
16
+
13
17
  def find(criteria)
14
18
  restrict(criteria)
15
19
  end
@@ -33,6 +37,12 @@ RSpec.describe ROM::Relation::Curried do
33
37
  ArgumentError,
34
38
  "curried #{users_relation.class}#by_name relation was called without any arguments")
35
39
  end
40
+
41
+ it 'returns self when has curried args and no additional args were provided' do
42
+ curried = users_relation.by_name_and_age.('Jane')
43
+
44
+ expect(curried.().__id__).to be(curried.__id__)
45
+ end
36
46
  end
37
47
 
38
48
  describe '#respond_to?' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica