farseer 0.1.0 → 0.2.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 +19 -0
- data/lib/farseer/version.rb +1 -1
- data/lib/farseer.rb +13 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b8bac73063c688f56761f2caa1b1d39e85d5b6d223c91b6ac740e67cabef2fd
|
4
|
+
data.tar.gz: 0e7dc8649076c4e3a4dc64fe82ddd33502aefac07d88d9c25f6afd03697c34c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 720de5181905dc67ba3d8d79d0b521f9e2b04e363b222e16056a59da06aaac70b7cf521229fbda7063cadd7719361512cfc4aa62bb66a7811e25a71d1085144e
|
7
|
+
data.tar.gz: 5194bf97b874845e39f5e1c1f5cedc110dbf603f3fc97f55f482ff6d69dece2a6df67a525dfffdfb1cf0bb3ee31423a46d44ae9649f03d1f39be018d52a668f0
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Farseer
|
4
|
+
class Result
|
5
|
+
def initialize(token, rest)
|
6
|
+
@token = token
|
7
|
+
@rest = rest
|
8
|
+
freeze
|
9
|
+
end
|
10
|
+
attr_reader :token, :rest
|
11
|
+
|
12
|
+
def eql?(other)
|
13
|
+
self.class.eql?(other.class) and
|
14
|
+
self.token.eql?(other.token) and
|
15
|
+
self.rest.eql?(other.rest)
|
16
|
+
end
|
17
|
+
alias == eql?
|
18
|
+
end
|
19
|
+
end
|
data/lib/farseer/version.rb
CHANGED
data/lib/farseer.rb
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'muina'
|
3
4
|
require 'zeitwerk'
|
4
5
|
loader = Zeitwerk::Loader::for_gem
|
5
6
|
loader.setup
|
6
7
|
|
7
8
|
module Farseer
|
9
|
+
Maybe = Muina::Maybe
|
10
|
+
|
11
|
+
module_function
|
12
|
+
|
13
|
+
def char_parser
|
14
|
+
->(char, input) {
|
15
|
+
case input[0]
|
16
|
+
when char then Maybe.return(Result.new(input[0], input[1..]))
|
17
|
+
else Maybe.none
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
8
21
|
end
|
9
22
|
|
10
23
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaporyhumo
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: muina
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: zeitwerk
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,6 +48,7 @@ files:
|
|
34
48
|
- LICENSE
|
35
49
|
- README.md
|
36
50
|
- lib/farseer.rb
|
51
|
+
- lib/farseer/result.rb
|
37
52
|
- lib/farseer/version.rb
|
38
53
|
homepage: https://github.com/vaporyhumo/farseer
|
39
54
|
licenses:
|