totally_lazy 0.1.45 → 0.1.46

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
- ZjhhYmY1NzQzYTQ3MGI3NDM5OGI3ODFkNGYzY2Y4YjFkMzQwYjZkNg==
4
+ NmM2NzAxZTc5YTMyOTZhOGRlZmExNjA0YWJlM2FlMGY4ZTliOTdkMw==
5
5
  data.tar.gz: !binary |-
6
- MWVlYmZkOTA1YmE0ZmI0YWQzMDQ2MWJmOTM3ZGVhM2JmMTMyODhhMg==
6
+ MWRlOTNiNjJkZTcwNmI5ZjVhY2VkM2NkZWI5MDE5MDQwMmFmZDRiZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWRmZmFhMjMyMDdlYTk1N2MxYzAxNDI3NTE0MTQzNTMwNzMyODcyZmM2OGVh
10
- ZWFlMjFhMmYyYzJiYjU2M2Y0YTNlYzI5NjY3ZGQzNTFkNGY3OWVkYjVjOThm
11
- YTIyZDBlN2EyZmZmNzdlNWY3MDAzZTZiMDllMzBhZGE5YjRiZmE=
9
+ ZmIyNTFiZjJiNDRkYmEzM2Y4OTI3M2E3N2JiY2UwZGY0MjU5ZThjMzFhZDli
10
+ MDEyNGI2N2E1Njk0MDc3YWY3NjllMWQ4OWNhOWRmMTc4MDA1OGE0Mzg4Mjlh
11
+ ZjFjNTA2ODk2ZDUyNTc4YjYwNDBmMDdhNjI5NjE0NmVkODFlMTc=
12
12
  data.tar.gz: !binary |-
13
- MjhiYzIxYzAxMDZhZTUyYWE5MWU4MWFkODBhNzI0MjkyYmNhZTE0MDIzZWQ0
14
- OWJkOGVlOTA3Yzk0MzE2MjZjZGI3Y2RlYzNlZDg4NDlkNGE5MGJjZGVmYjll
15
- ZTUxNTM5ZTc4MWE5YmVlMTIzZjg1MTMzM2RjODM5NzJjODA5NTY=
13
+ NWVlZTBiMWI4M2YxMTA0NzQ2Y2FkMWJlNDBkYzhlMGE3MTExNTZjZDU1NTJh
14
+ YTEzNTJkNmZjNjUwOTAzM2E1NDcxNDRlMDI5ZWM4OTQ0NjdkYjM4MDQ4OGJi
15
+ OGJlMTFiMjczMWVkYWQ0NTNmZDhiMzYzMjViNjdlOGI3YzQyMTY=
@@ -20,4 +20,8 @@ module Predicates
20
20
  ->(this) { this == that }
21
21
  end
22
22
  alias is equal_to?
23
+
24
+ def where(fn, predicate)
25
+ ->(value) { predicate.(fn.(value)) }
26
+ end
23
27
  end
@@ -11,4 +11,21 @@ describe 'Predicates' do
11
11
  expect(sequence('Stuff').find(equal_to?('Stuff'))).to eq(some('Stuff'))
12
12
  expect(sequence('Stuff').find(is('Nothing'))).to eq(none)
13
13
  end
14
+
15
+ class Person
16
+ attr_reader :name
17
+ attr_reader :age
18
+
19
+ def initialize(name, age)
20
+ @name = name
21
+ @age = age
22
+ end
23
+ end
24
+
25
+ it 'should allow where' do
26
+ raymond = Person.new('Raymond', 41)
27
+ mathilda = Person.new('Mathilda', 4)
28
+ age = ->(person) { person.age }
29
+ expect(sequence(raymond, mathilda).filter(where(age, greater_than(40)))).to eq(sequence(raymond))
30
+ end
14
31
  end
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.45
4
+ version: 0.1.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-01 00:00:00.000000000 Z
12
+ date: 2016-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby-edge