farseer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/farseer/result.rb +1 -1
- data/lib/farseer/version.rb +1 -1
- data/lib/farseer.rb +17 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e83ade307369289f0309fc0256195a5a3a04fe32fb0fd04861ee82cbd4951f
|
4
|
+
data.tar.gz: 7b8f7f64e9df97de253b9fa63d4ff452c47baafcbabb9693f0b4f39d30190015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b262cadaffd22a2d97d5c3a5bad3f216a71df75b2c87d8536e1310249b8b5053735c2d6a918716edcbaface20c3629a45527ccd07503223118ae2daf92a4150
|
7
|
+
data.tar.gz: d7f8ef841e8b6f32dfda21fa2000ef80f30a28e7339394940b7b67b7ae12a052e99474d013b15f2359d1b52e09d4c8a06722990ba40c04622cb4d4ba6d72f3c3
|
data/lib/farseer/result.rb
CHANGED
data/lib/farseer/version.rb
CHANGED
data/lib/farseer.rb
CHANGED
@@ -6,18 +6,30 @@ loader = Zeitwerk::Loader::for_gem
|
|
6
6
|
loader.setup
|
7
7
|
|
8
8
|
module Farseer
|
9
|
+
WS_REGEX = /^(\s*)(.*)$/
|
9
10
|
Maybe = Muina::Maybe
|
10
11
|
|
11
12
|
module_function
|
12
13
|
|
13
14
|
def char_parser
|
14
|
-
->(char, input) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
->(char, input) { Farseer.__send__(:char_parser_helper, char, input) }.curry
|
16
|
+
end
|
17
|
+
|
18
|
+
def ws_parser
|
19
|
+
->(input) {
|
20
|
+
match = input.match(WS_REGEX)
|
21
|
+
|
22
|
+
Maybe.return(Result.new(match[1], match[2]))
|
19
23
|
}
|
20
24
|
end
|
25
|
+
|
26
|
+
def char_parser_helper(char, input)
|
27
|
+
case input[0]
|
28
|
+
when char then Maybe.return(Result.new(input[0], input[1..]))
|
29
|
+
else Maybe.none
|
30
|
+
end
|
31
|
+
end
|
32
|
+
private :char_parser_helper
|
21
33
|
end
|
22
34
|
|
23
35
|
loader.eager_load
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farseer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaporyhumo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: muina
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|