muina 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7322acdc8c2503f893db20260a561551cd9cc3350d07ccaa7c0a9b929ce7007
4
- data.tar.gz: 29679c640cc94c29860a9237cf82bcd9fcb3c363481dbe214ccbe5b3ac8e5feb
3
+ metadata.gz: 6455e37c318b57b20d89adcb6c5a6f684bca41c109242c8cf794c8233580a4f9
4
+ data.tar.gz: 07f7a32d10145c3780dee62b6a97437274e8f595cb889e0cee01818038665219
5
5
  SHA512:
6
- metadata.gz: 3f2fec87c12b2e968d621663781b9e9e079f10fd6bda0e7d9aabadbeadbd01851de54eb1e393def47e63b066a3c0c62dcc1cf5f101e8b33bb68b9c10430c2f02
7
- data.tar.gz: 1431602da952ac911732a3284c9a6f73383ddecb20c4b1fe2bb477a970c8724404c6097518a0ee5d8005d10cd631c03a519aebc032173f060af3fc5d4ae4ada8
6
+ metadata.gz: 85336bd3e9e13e0ede2d5f8a4eeacefdc49c1f9428ce084d6921b964ab17683129c9c60a59817c29137a0b25a55d1970fb3d59e49279f3f171a88f9d0d43edf7
7
+ data.tar.gz: 2fb0728d76c26fdc8e84f9947cc6df4fe2bd3b6e102ebc53050c0cbabdcbfc6c0a48c2a7638a8790c3ab54b85ebca1e484b9b7773078244e2e916dad478d1064
@@ -4,7 +4,7 @@ module Muina
4
4
  class Maybe
5
5
  class None < self
6
6
  private_class_method(:new)
7
- def initialize
7
+ def initialize # rubocop:disable Lint/MissingSuper
8
8
  freeze
9
9
  end
10
10
 
@@ -17,7 +17,7 @@ module Muina
17
17
  end
18
18
 
19
19
  def value!
20
- raise
20
+ raise UnwrappingError
21
21
  end
22
22
 
23
23
  def value_or(default)
@@ -28,9 +28,7 @@ module Muina
28
28
  yield
29
29
  end
30
30
 
31
- def value_or_nil
32
- nil
33
- end
31
+ def value_or_nil; end
34
32
 
35
33
  def and_then
36
34
  self
@@ -3,11 +3,11 @@
3
3
  module Muina
4
4
  class Maybe
5
5
  class Some < self
6
- def initialize(value)
6
+ private_class_method(:new)
7
+ def initialize(value) # rubocop:disable Lint/MissingSuper
7
8
  @value = value
8
9
  freeze
9
10
  end
10
- private_class_method(:new)
11
11
 
12
12
  def some?
13
13
  true
@@ -21,7 +21,7 @@ module Muina
21
21
  @value
22
22
  end
23
23
 
24
- def value_or(default)
24
+ def value_or(_default)
25
25
  @value
26
26
  end
27
27
 
@@ -60,7 +60,7 @@ module Muina
60
60
 
61
61
  def ==(other)
62
62
  self.class == other.class &&
63
- self.value! == other.value!
63
+ value! == other.value!
64
64
  end
65
65
  end
66
66
  end
data/lib/muina/maybe.rb CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  module Muina
4
4
  class Maybe
5
- def self.return(value)
6
- Some.__send__(:new, value)
7
- end
5
+ UnwrappingError = Class.new(Error)
6
+
7
+ class << self
8
+ def return(value)
9
+ Some.__send__(:new, value)
10
+ end
11
+ alias some return
8
12
 
9
- def self.none
10
- None.__send__(:new)
13
+ def none
14
+ None.__send__(:new)
15
+ end
11
16
  end
12
17
  end
13
18
  end
@@ -3,7 +3,7 @@
3
3
  module Muina
4
4
  class Result
5
5
  class Failure < self
6
- def initialize(error)
6
+ def initialize(error) # rubocop:disable Lint/MissingSuper
7
7
  @error = error
8
8
  freeze
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Muina
4
4
  class Result
5
5
  class Success < self
6
- def initialize(value)
6
+ def initialize(value) # rubocop:disable Lint/MissingSuper
7
7
  @value = value
8
8
  freeze
9
9
  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.5.0'
4
+ VERSION = '0.6.0'
5
5
  public_constant :VERSION
6
6
  end
data/lib/muina.rb CHANGED
@@ -5,6 +5,7 @@ loader = Zeitwerk::Loader.for_gem
5
5
  loader.setup
6
6
 
7
7
  module Muina
8
+ Error = Class.new(StandardError)
8
9
  end
9
10
 
10
11
  loader.eager_load
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.5.0
4
+ version: 0.6.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-03 00:00:00.000000000 Z
11
+ date: 2024-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk