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
- NmM2NzAxZTc5YTMyOTZhOGRlZmExNjA0YWJlM2FlMGY4ZTliOTdkMw==
4
+ ODUyNTEyOTNlZmZkOTQ5Y2U0ODdlOGU4MTE1ODlmYzk1YWQ1YzE1ZA==
5
5
  data.tar.gz: !binary |-
6
- MWRlOTNiNjJkZTcwNmI5ZjVhY2VkM2NkZWI5MDE5MDQwMmFmZDRiZA==
6
+ NDM4NDQyY2JkNTBmNzM2NjA0NTdiMjUyZTFkN2M0ODkyZmQ5ZGYxZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmIyNTFiZjJiNDRkYmEzM2Y4OTI3M2E3N2JiY2UwZGY0MjU5ZThjMzFhZDli
10
- MDEyNGI2N2E1Njk0MDc3YWY3NjllMWQ4OWNhOWRmMTc4MDA1OGE0Mzg4Mjlh
11
- ZjFjNTA2ODk2ZDUyNTc4YjYwNDBmMDdhNjI5NjE0NmVkODFlMTc=
9
+ NzhiMzgzMjdiZjQ3NjA4ZWI2NGE1MTAyNDVlZThhNjc5N2I3NzZhYjZlMDQ1
10
+ YjNjZDE1Zjg0Zjc2NGNjYTRiMWViZmIwM2FjNGNiN2Q1NzdiZTAzY2NjNzFl
11
+ MmExYzY3YzQ4Njc0ZjMyYTBmN2NkMjExMTJiYmZlYWQ4NDM1MjE=
12
12
  data.tar.gz: !binary |-
13
- NWVlZTBiMWI4M2YxMTA0NzQ2Y2FkMWJlNDBkYzhlMGE3MTExNTZjZDU1NTJh
14
- YTEzNTJkNmZjNjUwOTAzM2E1NDcxNDRlMDI5ZWM4OTQ0NjdkYjM4MDQ4OGJi
15
- OGJlMTFiMjczMWVkYWQ0NTNmZDhiMzYzMjViNjdlOGI3YzQyMTY=
13
+ NzgwYjhiZWY1NWIxNDNkYzg3NDEzZTBiYTE5NTI4Yzc2MTAxYjVmZTYxMzM2
14
+ MWE4MDAzMjVlOTkxMzNmZTVjN2Y1ZGRhZjVjMGQzMDNmNDBlOWUwNjBlZjFm
15
+ MzY5MDZhOWVmMTRmNWU3MWQ3OTBlOTBmMDNjMTI0OWZmYmM1MGQ=
@@ -1,6 +1,6 @@
1
1
  module Predicates
2
2
  private
3
- def _not(pred)
3
+ def is_not(pred)
4
4
  -> (bool) { !pred.(bool) }
5
5
  end
6
6
 
@@ -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(_not(block_given? ? ->(value) { block_pred.call(value) } : fn_pred))
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(_not(even))).to eq(sequence(1, 3))
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totally_lazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.46
4
+ version: 0.1.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow