servactory 2.4.1 → 2.4.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: 39039d8976222bae22b66ec4ee41d231a5ec589509bd32e15c717b0ef6c89d19
4
- data.tar.gz: 8c4de62f3d586fc7d767d17cd6918b30e7a0521e2bb01e3ed5f69e34b26694db
3
+ metadata.gz: fbf66d2c89ef6a0b50a80343230e56d940e41ce3754528cc902dbf17663800a7
4
+ data.tar.gz: dc302908e1305c9b9cbecacf1506fe9222db5e9b835fd0e8febb6e54e1211b92
5
5
  SHA512:
6
- metadata.gz: b062e9ceeb16e47ee61133fccda32d8bca81e57424e76a849d7cdf9fb3491016a4a2ca61675142319a11f1286d9bdcc9388db5c4069d8d434df3ab827adc1124
7
- data.tar.gz: fdd074ac75c620cfdd41a5fb6173d83b7d87835d0bf1a572bf5e815e7f1db028312a6b7afc91c19ad06208917318afe884a87de64685853868c6dea57ab3ff57
6
+ metadata.gz: b9eb5b104b1ff966b92b2f656070379daf252d00921937383e094549bc3ae3a7782b6e43cbdec08051b38168a1d2d7f8e38d4b90e9c6a367828fd40c66218399
7
+ data.tar.gz: 2b51810de55de6b8a13ba4f7cc22e2ebd913839cd86fa68f05cec9c83b5558dbcba9bf13cf194f163287c5c7a0d7bab5bdf5a715b159106338611cc2d082c706
@@ -22,7 +22,7 @@ module Servactory
22
22
  rescue config.success_class => e
23
23
  Servactory::Result.success_for(context: e.context)
24
24
  rescue config.failure_class => e
25
- Servactory::Result.failure_for(exception: e)
25
+ Servactory::Result.failure_for(context: context, exception: e)
26
26
  end
27
27
 
28
28
  private
@@ -19,11 +19,11 @@ module Servactory
19
19
  new(context: context).send(:as_success)
20
20
  end
21
21
 
22
- def self.failure_for(exception:)
23
- new(exception: exception).send(:as_failure)
22
+ def self.failure_for(context:, exception:)
23
+ new(context: context, exception: exception).send(:as_failure)
24
24
  end
25
25
 
26
- def initialize(context: nil, exception: nil)
26
+ def initialize(context:, exception: nil)
27
27
  @context = context
28
28
  @exception = exception
29
29
  end
@@ -78,6 +78,10 @@ module Servactory
78
78
  false
79
79
  end
80
80
 
81
+ outputs.methods(false).each do |method_name|
82
+ define_singleton_method(method_name) { outputs.send(method_name) }
83
+ end
84
+
81
85
  self
82
86
  end
83
87
 
@@ -7,8 +7,8 @@ module Servactory
7
7
  Servactory::Result.success_for(context: new(attributes))
8
8
  end
9
9
 
10
- def self.as_failure(exception: nil)
11
- Servactory::Result.failure_for(exception: exception)
10
+ def self.as_failure(attributes = {}, exception: nil)
11
+ Servactory::Result.failure_for(context: new(attributes), exception: exception)
12
12
  end
13
13
 
14
14
  def initialize(attributes = {})
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 4
7
- PATCH = 1
7
+ PATCH = 2
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-26 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport