farseer 0.3.0 → 0.4.0

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
  SHA256:
3
- metadata.gz: d5e83ade307369289f0309fc0256195a5a3a04fe32fb0fd04861ee82cbd4951f
4
- data.tar.gz: 7b8f7f64e9df97de253b9fa63d4ff452c47baafcbabb9693f0b4f39d30190015
3
+ metadata.gz: 0def0ee29c72d62793716f625d64e599c00f02a30f790062d9e7ae61fb905fea
4
+ data.tar.gz: 53701b2c7ce3ed0ff8744b43d48587be8ee4530cb776be24cd5ba87eb908dd19
5
5
  SHA512:
6
- metadata.gz: 8b262cadaffd22a2d97d5c3a5bad3f216a71df75b2c87d8536e1310249b8b5053735c2d6a918716edcbaface20c3629a45527ccd07503223118ae2daf92a4150
7
- data.tar.gz: d7f8ef841e8b6f32dfda21fa2000ef80f30a28e7339394940b7b67b7ae12a052e99474d013b15f2359d1b52e09d4c8a06722990ba40c04622cb4d4ba6d72f3c3
6
+ metadata.gz: 5ef7c3e3fc84215f25c5ea48d9e8af9d5c8bbed1f4bd01bd0756259c5228008ef0c519d01987da29b0dc200dcddc3e5161de9063a6af3c8611ba7e7c1e54c2fc
7
+ data.tar.gz: a3d7fab449c4904680e265547c4416ddff9c2a16ba0b4c047ecb9975d6fedc825d50b78e2c0ff52d8a5aaa84b9e4ce1dda4348fe869bf76f276877280a06b107
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Farseer
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  public_constant :VERSION
6
6
  end
data/lib/farseer.rb CHANGED
@@ -9,13 +9,15 @@ module Farseer
9
9
  WS_REGEX = /^(\s*)(.*)$/
10
10
  Maybe = Muina::Maybe
11
11
 
12
- module_function
12
+ def self.any_char_parser
13
+ ->(chars, input) { Farseer.__send__(:any_char_parser_helper, chars, input) }.curry
14
+ end
13
15
 
14
- def char_parser
16
+ def self.char_parser
15
17
  ->(char, input) { Farseer.__send__(:char_parser_helper, char, input) }.curry
16
18
  end
17
19
 
18
- def ws_parser
20
+ def self.ws_parser
19
21
  ->(input) {
20
22
  match = input.match(WS_REGEX)
21
23
 
@@ -23,13 +25,22 @@ module Farseer
23
25
  }
24
26
  end
25
27
 
26
- def char_parser_helper(char, input)
28
+ private
29
+
30
+ def self.char_parser_helper(char, input)
27
31
  case input[0]
28
32
  when char then Maybe.return(Result.new(input[0], input[1..]))
29
33
  else Maybe.none
30
34
  end
31
35
  end
32
- private :char_parser_helper
36
+
37
+ def self.any_char_parser_helper(chars, input)
38
+ if chars.any? { |char| char == input[0] }
39
+ Maybe.return(Result.new(input[0], input[1..]))
40
+ else
41
+ Maybe.none
42
+ end
43
+ end
33
44
  end
34
45
 
35
46
  loader.eager_load
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: farseer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaporyhumo