totally_lazy 0.1.41 → 0.1.42

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
- NDE2NTBhYTJiMDVjODMxMGZhZTRiMzA4YzZkOWE1N2E2ZTU1NTFjOA==
4
+ YjQwNzc5MDVjYmQwNjJkY2RkODM3YmM3NjdmYTU2MTMyM2FhNjU5OA==
5
5
  data.tar.gz: !binary |-
6
- NmU3ZThlYWRmNmZlMmRhOWE1ZmZjN2JjMWMwZjZmMzA4ZjJlOGY4OQ==
6
+ YzNlMjk2MzU4M2NjZDg2N2NjZmMzZWFjZjBhMjRlNTI1NzA0YTZkYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTU3MmQyZDQ5ZGY2NjQyMGFjNTJjNWY2YTE5MmE1YzRkZGEwNGRmODRmMjU5
10
- Y2UwZTE3Yjg0MjkwZmU4ZTk2NDliMTg2MTE5ZjdlMDJjYWNkM2NjYjIzMzRi
11
- MmVlMGM0YTEyZmFjNzYzNjE3ZDcyNjZmMmU4ZGY2ZTExMjBiYjg=
9
+ NjU5N2JlMDM4NTM4MGE0YzA3NDQ5NzRkZWExZjM1MDcwZTA5NGNiODM5MDU5
10
+ MjE5OTk5NDk4OWQzOTY5MWM2Y2VmMmVkMzFmZDJjMTU1YWNmNDdkNDU5YmZm
11
+ MDk5ZGRmMWE3YmRiZTVkN2U5NTQyYmQyMzA2OTVkOWRhMDI3YTc=
12
12
  data.tar.gz: !binary |-
13
- MDA0ZmI4OTk1ZWVjZGE4YzIwMzczOTdhNTM1NjNjNTVkOTEyYjY5M2RiYzBh
14
- MTEzOGZhYjg1N2U2ZWIwMzk2ZGI0MzcyYzdhNjljMWJhY2ExYjc5MDc1ZTNk
15
- ODRkNDY3N2UzZWMwMDliYTJjYWRhMWRmZDA5YTA4ZDY0YmRmOTU=
13
+ NTA2NDJmOTJkYWUyNTUzMDAxNjU1Njc5NjI4Y2RkN2I5NmE1ZTUzNTFlOTZj
14
+ NzNiNTg3MjViMGM1NmFkYzU4OGYwZjdjNDc5ZTgzYjRhMmJkNzcxYzk4OGYy
15
+ OTRmODBhYWNiOGRjZDE3ZGVhOWNhOTFhZjZlZDE5ZmFhZDkzOGQ=
@@ -11,4 +11,8 @@ module Predicates
11
11
  def is_right?
12
12
  -> (either) { either.is_right? }
13
13
  end
14
+
15
+ def matches?(regex)
16
+ ->(value) { !regex.match(value).nil? }
17
+ end
14
18
  end
@@ -0,0 +1,8 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe 'Predicates' do
4
+ it 'should allow regex matching' do
5
+ expect(sequence('Stacy').find(matches?(/Stac/))).to eq(some('Stacy'))
6
+ expect(sequence('Raymond').find(matches?(/NotAwesome/))).to eq(none)
7
+ end
8
+ 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.41
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow
@@ -172,6 +172,7 @@ files:
172
172
  - spec/totally_lazy/either_spec.rb
173
173
  - spec/totally_lazy/maps_spec.rb
174
174
  - spec/totally_lazy/option_spec.rb
175
+ - spec/totally_lazy/predicates_spec.rb
175
176
  - spec/totally_lazy/sequence_spec.rb
176
177
  - totally_lazy.iml
177
178
  homepage: http://github.com/raymanoz/totally_lazy