use_cases 3.0.1 → 3.0.2

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: 7024d7b5fb5fefe4415f79eb2e81b101a8d9b2ffcf25babf81448f0456f013cf
4
- data.tar.gz: e9157f8e7b58dbfe6bdb5b23165f7b47a05634cc2fde3a6f88fd8d5aa2b84b3d
3
+ metadata.gz: 85052ba74b76415cee8c9450c1705bc4b23d695f74625bd20ecb72a034bc34c5
4
+ data.tar.gz: 4bcae2e34010a1e321e366066c79add5565a6805a38962e6a1478aa032f5869c
5
5
  SHA512:
6
- metadata.gz: 9fff1b2f8fbcde7e4218bb0745c80dd94f1ddadaa624eb0aa7a23ae22f2986bdaf23dadf6008d090a1a72695a7b56513ff4427e7cc30281f256bc9899f08e53f
7
- data.tar.gz: e0b84b5934b3f891e550a21d6e53a4295df76e6d827fb734b8e05c1968dee9b03112d2ef2149fa28c01bbc0df6060ad415ffd0db56b60bfe56c17149112e588a
6
+ metadata.gz: 158ffaaf8361d65b2747a7cc7f7349f84aefcb36a86b4fda5b45435bbb998e042b8d48bc4f305d52bcaca7072245bfce01e9befc1a47820e85920939059a917c
7
+ data.tar.gz: 6ed08ac0933e1e39d3249eaf637079e5c72d790770953a9d29aa2d3dd186474041a8119a1e2949ffa23537828dd3575001d06e163c303257dac5b35ecde25322
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- use_cases (3.0.0)
4
+ use_cases (3.0.1)
5
5
  activesupport (>= 6.1.7)
6
6
  dry-matcher (>= 0.8.1)
7
7
  dry-monads (>= 1.0.0)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "dry/validation"
3
4
  require "dry/validation/contract"
4
5
 
5
6
  module UseCases
@@ -10,9 +10,19 @@ module UseCases
10
10
  @result = result
11
11
  end
12
12
 
13
+ def method_missing(method, *args, &block)
14
+ return result.send(method, *args, &block) if result.respond_to?(method)
15
+
16
+ super
17
+ end
18
+
19
+ def respond_to_missing?(method, include_private = false)
20
+ result.respond_to?(method, include_private) || super
21
+ end
22
+
13
23
  def value
14
24
  return result if result_not_monad?
15
- return nil if result_empty?
25
+ return if result_empty?
16
26
 
17
27
  result.success? ? result.value! : result.failure
18
28
  end
@@ -39,7 +49,7 @@ module UseCases
39
49
  end
40
50
 
41
51
  def to_result
42
- self
52
+ result
43
53
  end
44
54
 
45
55
  def result_empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UseCases
4
- VERSION = "3.0.1"
4
+ VERSION = "3.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_cases
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ring Twice
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport