totally_lazy 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODUyNTEyOTNlZmZkOTQ5Y2U0ODdlOGU4MTE1ODlmYzk1YWQ1YzE1ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDM4NDQyY2JkNTBmNzM2NjA0NTdiMjUyZTFkN2M0ODkyZmQ5ZGYxZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzhiMzgzMjdiZjQ3NjA4ZWI2NGE1MTAyNDVlZThhNjc5N2I3NzZhYjZlMDQ1
|
10
|
+
YjNjZDE1Zjg0Zjc2NGNjYTRiMWViZmIwM2FjNGNiN2Q1NzdiZTAzY2NjNzFl
|
11
|
+
MmExYzY3YzQ4Njc0ZjMyYTBmN2NkMjExMTJiYmZlYWQ4NDM1MjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzgwYjhiZWY1NWIxNDNkYzg3NDEzZTBiYTE5NTI4Yzc2MTAxYjVmZTYxMzM2
|
14
|
+
MWE4MDAzMjVlOTkxMzNmZTVjN2Y1ZGRhZjVjMGQzMDNmNDBlOWUwNjBlZjFm
|
15
|
+
MzY5MDZhOWVmMTRmNWU3MWQ3OTBlOTBmMDNjMTI0OWZmYmM1MGQ=
|
@@ -281,7 +281,7 @@ class Sequence
|
|
281
281
|
|
282
282
|
def reject(fn_pred=nil, &block_pred)
|
283
283
|
assert_funcs(fn_pred, block_given?)
|
284
|
-
filter(
|
284
|
+
filter(is_not(block_given? ? ->(value) { block_pred.call(value) } : fn_pred))
|
285
285
|
end
|
286
286
|
|
287
287
|
def group_by(fn=nil, &block)
|
@@ -21,11 +21,15 @@ describe 'Predicates' do
|
|
21
21
|
@age = age
|
22
22
|
end
|
23
23
|
end
|
24
|
+
raymond = Person.new('Raymond', 41)
|
25
|
+
mathilda = Person.new('Mathilda', 4)
|
26
|
+
age = ->(person) { person.age }
|
24
27
|
|
25
28
|
it 'should allow where' do
|
26
|
-
raymond = Person.new('Raymond', 41)
|
27
|
-
mathilda = Person.new('Mathilda', 4)
|
28
|
-
age = ->(person) { person.age }
|
29
29
|
expect(sequence(raymond, mathilda).filter(where(age, greater_than(40)))).to eq(sequence(raymond))
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'should be able to negate other predicates using is_not' do
|
33
|
+
expect(sequence(raymond).filter(where(age, is_not(greater_than(40))))).to eq(empty)
|
34
|
+
end
|
31
35
|
end
|
@@ -79,7 +79,7 @@ describe 'Sequence' do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'should support composite predicates' do
|
82
|
-
expect(sequence(1, 2, 3, 4).filter(
|
82
|
+
expect(sequence(1, 2, 3, 4).filter(is_not(even))).to eq(sequence(1, 3))
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should support reject' do
|