muina 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: b2b5222927ea1bfd1e6abec8b52f4be5496b472cbb661473ff790a0e3e608b74
4
- data.tar.gz: fc283c096aaea590df228972a7d1c74dfa882274a12ba791de319d294f21e624
3
+ metadata.gz: 868d82b70df649f4904a718c34d487f5c05da90a0e9d28620765c080cb970020
4
+ data.tar.gz: 322edb475ebf673ae7d54b8bae3e6c44a0a0be9b7a2bb80df5d27f474b35d90c
5
5
  SHA512:
6
- metadata.gz: b6df6e69e9d809a4e4f99685653a01a73c6d2ef851fa034c221bad0970682b55d1f7d500150eb45241453c3fba4b4ec72787c7d30feb9929931461fc5fac6ba7
7
- data.tar.gz: 609cca9f912c9a79d39be44f455ebc0c7e6fe4fc8e267bd4291f7e77d8a1234f1fa85b8680a62fffc1005ddd15620db937996809ef72cf7628d10d3fc8334660
6
+ metadata.gz: 996ea7ae5699568af2096e486edf7df2eaf72c4ca7b2dfd1d40d3c54483fa1c2d97227f1c53947ec674a698a8abd5368e5fb854fc5a998c2ec0cbe231094bec6
7
+ data.tar.gz: a93c3d768491556b845fbeb7d00e7424e5b9966b1ed5b940abc627f4b9a873b7184615c4e5f55f55a073fe0e1ece527610e48055a0dac8a5e84156438c96bcae
@@ -4,6 +4,10 @@ module Muina
4
4
  class Maybe
5
5
  class None < self
6
6
  private_class_method(:new)
7
+ def initialize
8
+ freeze
9
+ end
10
+
7
11
  def some?
8
12
  false
9
13
  end
@@ -5,6 +5,7 @@ module Muina
5
5
  class Some < self
6
6
  def initialize(value)
7
7
  @value = value
8
+ freeze
8
9
  end
9
10
  private_class_method(:new)
10
11
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Muina
4
+ class Result
5
+ class Failure < self
6
+ def initialize(error)
7
+ @error = error
8
+ freeze
9
+ end
10
+
11
+ def value!
12
+ raise
13
+ end
14
+
15
+ def error!
16
+ @error
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Muina
4
+ class Result
5
+ class Success < self
6
+ def initialize(value)
7
+ @value = value
8
+ freeze
9
+ end
10
+
11
+ def value!
12
+ @value
13
+ end
14
+
15
+ def error!
16
+ raise
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Muina
4
+ class Result
5
+ private_class_method :new
6
+
7
+ def self.success(value)
8
+ Success.__send__(:new, value)
9
+ end
10
+
11
+ def self.failure(error)
12
+ Failure.__send__(:new, error)
13
+ end
14
+ end
15
+ end
data/lib/muina/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Muina
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  public_constant :VERSION
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muina
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
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-02 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -37,6 +37,9 @@ files:
37
37
  - lib/muina/maybe.rb
38
38
  - lib/muina/maybe/none.rb
39
39
  - lib/muina/maybe/some.rb
40
+ - lib/muina/result.rb
41
+ - lib/muina/result/failure.rb
42
+ - lib/muina/result/success.rb
40
43
  - lib/muina/version.rb
41
44
  homepage: https://github.com/vaporyhumo/muina
42
45
  licenses: