opera 0.2.16 → 0.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/opera/operation/executor.rb +4 -0
- data/lib/opera/operation/instructions/executors/operation.rb +3 -1
- data/lib/opera/operation/instructions/executors/operations.rb +1 -1
- data/lib/opera/operation/instructions/executors/step.rb +1 -1
- data/lib/opera/operation/instructions/executors/validate.rb +1 -1
- data/lib/opera/operation/result.rb +9 -11
- data/lib/opera/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5f102d05b4d0cbf79d677bc5697388b51f643dfa5a880426894f1c6b30b70dc
|
4
|
+
data.tar.gz: a30d504859167c71b902ac30dbc03bcf8ea048575aa08a5f0b26864e24c51be9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69fe6abf0538339b075da566f75d8b18e60533cb33254bc25a5e495f49e89fa065a2abe2ee65c8e79cbf5b222a68284ac3f6a8a5fb37c9453a5a767d58d9caf1
|
7
|
+
data.tar.gz: 12630548b31111d555ffc9e7e95d2d07d5f6fd919feac47ffab3c152587d700a2f4460f927456242b7a23b414ae37d8a152cb9d0f3cd6ea74276894f3dad385e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Opera Changelog
|
2
2
|
|
3
|
+
### 0.2.18 - September 20, 2024
|
4
|
+
|
5
|
+
- added `output!` method on Result object
|
6
|
+
- deleted `to_h` alias for `output`
|
7
|
+
|
8
|
+
### 0.2.17 - July 8, 2024
|
9
|
+
|
10
|
+
- minor fix `mode` configuration option.
|
11
|
+
|
3
12
|
### 0.2.16 - June 8, 2024
|
4
13
|
|
5
14
|
- add `mode` configuration option. When set to `:production` we optimize memory usage by skipping storing executions.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -880,6 +880,7 @@ Opera::Operation::Result.new(output: 'success')
|
|
880
880
|
- failure? - [true, false] - Return true if any error or exception
|
881
881
|
- output - [Anything] - Return Anything
|
882
882
|
- output=(Anything) - Sets content of operation output
|
883
|
+
- output! - Return Anything if Success, raise exception if Failure
|
883
884
|
- add_error(key, value) - Adds new error message
|
884
885
|
- add_errors(Hash) - Adds multiple error messages
|
885
886
|
- add_exception(method, message, classname: nil) - Adds new exception
|
@@ -18,7 +18,9 @@ module Opera
|
|
18
18
|
end
|
19
19
|
|
20
20
|
execution = result.executions.pop
|
21
|
-
result.add_execution(execution => operation_result.executions)
|
21
|
+
result.add_execution(execution => operation_result.executions) unless production_mode?
|
22
|
+
|
23
|
+
operation_result
|
22
24
|
end
|
23
25
|
|
24
26
|
private
|
@@ -45,7 +45,7 @@ module Opera
|
|
45
45
|
def add_results(instruction, results)
|
46
46
|
add_instruction_output(instruction, results.map(&:output))
|
47
47
|
execution = result.executions.pop
|
48
|
-
result.add_execution(execution => results.map(&:executions))
|
48
|
+
result.add_execution(execution => results.map(&:executions)) unless production_mode?
|
49
49
|
end
|
50
50
|
|
51
51
|
def raise_error
|
@@ -8,7 +8,7 @@ module Opera
|
|
8
8
|
def call(instruction)
|
9
9
|
method = instruction[:method]
|
10
10
|
|
11
|
-
operation.result.add_execution(method)
|
11
|
+
operation.result.add_execution(method) unless production_mode?
|
12
12
|
operation.send(method)
|
13
13
|
rescue StandardError => exception
|
14
14
|
reporter&.error(exception)
|
@@ -3,14 +3,14 @@
|
|
3
3
|
module Opera
|
4
4
|
module Operation
|
5
5
|
class Result
|
6
|
+
class OutputError < StandardError; end
|
7
|
+
|
6
8
|
attr_reader :errors, # Acumulator of errors in validation + steps
|
7
9
|
:exceptions, # Acumulator of exceptions in steps
|
8
10
|
:information, # Temporal object to store related information
|
9
11
|
:executions # Stacktrace or Pipe of the methods evaludated
|
10
12
|
|
11
|
-
attr_accessor :output #
|
12
|
-
|
13
|
-
alias to_h output
|
13
|
+
attr_accessor :output # in case of success, it contains the resulting value
|
14
14
|
|
15
15
|
def initialize(output: nil, errors: {})
|
16
16
|
@errors = errors
|
@@ -32,6 +32,12 @@ module Opera
|
|
32
32
|
errors.merge(exceptions)
|
33
33
|
end
|
34
34
|
|
35
|
+
def output!
|
36
|
+
raise OutputError, 'Cannot retrieve output from a Failure.' if failure?
|
37
|
+
|
38
|
+
output
|
39
|
+
end
|
40
|
+
|
35
41
|
# rubocop:disable Metrics/MethodLength
|
36
42
|
def add_error(field, message)
|
37
43
|
@errors[field] ||= []
|
@@ -71,16 +77,8 @@ module Opera
|
|
71
77
|
end
|
72
78
|
|
73
79
|
def add_execution(step)
|
74
|
-
return if config.production_mode?
|
75
|
-
|
76
80
|
@executions << step
|
77
81
|
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
def config
|
82
|
-
Config
|
83
|
-
end
|
84
82
|
end
|
85
83
|
end
|
86
84
|
end
|
data/lib/opera/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ProFinda Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|