smart_core 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/smart_core/operation.rb +3 -31
- data/lib/smart_core/operation/result_interface.rb +34 -0
- data/lib/smart_core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08a93088fea508e62a40c0f7cd403b5f4b660372a3254453cd61be4a05a6635
|
4
|
+
data.tar.gz: ba732416c5af24d0aed8d685abb5b21fc76798a56af92aa1ad12d5d4d6da6a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45bbc699159a5f9b45e84f7e4c7389bf0c64a727826156f2061bfc5b8aca514832ef8af02dbdd3623dd35da52c7395155f48ae013cef2771535b088880113de1
|
7
|
+
data.tar.gz: 824492f55c4329b76bae550a8e280e235d78d79661ecab2c8cba362d80ed4d58adab77fbd7ff84c30a44ccfe0642285e65eaaa17332e92b5c543376eeffb9dd0
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.5.2] - 2019-06-05
|
5
|
+
### Added
|
6
|
+
- Common Result Object interface (realized as a mixin (`SmartCore::Operation::ResultInterface`))
|
7
|
+
|
4
8
|
## [0.5.1] - 2019-06-04
|
5
9
|
### Added
|
6
10
|
- Support for `Symobl` type definition in `SmartCore::Initializer`
|
data/lib/smart_core/operation.rb
CHANGED
@@ -11,10 +11,13 @@ class SmartCore::Operation
|
|
11
11
|
require_relative 'operation/success'
|
12
12
|
require_relative 'operation/failure'
|
13
13
|
require_relative 'operation/fatal'
|
14
|
+
require_relative 'operation/result_interface'
|
14
15
|
require_relative 'operation/instance_builder'
|
15
16
|
|
16
17
|
# @since 0.5.0
|
17
18
|
include SmartCore::Initializer
|
19
|
+
# @since 0.6.0
|
20
|
+
include SmartCore::Operation::ResultInterface
|
18
21
|
|
19
22
|
# @since 0.5.0
|
20
23
|
extend_initialization_flow do |operation|
|
@@ -46,35 +49,4 @@ class SmartCore::Operation
|
|
46
49
|
def call
|
47
50
|
Success()
|
48
51
|
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
# @param result_data [Hash<Symbol,Any>]
|
53
|
-
# @return [SmartCore::Operation::Success]
|
54
|
-
#
|
55
|
-
# @api public
|
56
|
-
# @since 0.2.0
|
57
|
-
def Success(**result_data) # rubocop:disable Naming/MethodName
|
58
|
-
SmartCore::Operation::Success.new(**result_data)
|
59
|
-
end
|
60
|
-
|
61
|
-
# @param errors [Array<Symbol|Any>]
|
62
|
-
# @return [SmartCore::Operation::Failure]
|
63
|
-
#
|
64
|
-
# @api public
|
65
|
-
# @since 0.2.0
|
66
|
-
def Failure(*errors) # rubocop:disable Naming/MethodName
|
67
|
-
SmartCore::Operation::Failure.new(*errors)
|
68
|
-
end
|
69
|
-
|
70
|
-
# @param errors [Array<Symbol|Any>]
|
71
|
-
# @return [SmartCore::Operation::Fatal]
|
72
|
-
#
|
73
|
-
# @raise [SmartCore::Operation::FatalError]
|
74
|
-
#
|
75
|
-
# @api public
|
76
|
-
# @since 0.2.0
|
77
|
-
def Fatal(*errors) # rubocop:disable Naming/MethodName
|
78
|
-
raise SmartCore::Operation::Fatal.new(*errors)
|
79
|
-
end
|
80
52
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @api public
|
4
|
+
# @since 0.5.2
|
5
|
+
module SmartCore::Operation::ResultInterface
|
6
|
+
# @param result_data [Hash<Symbol,Any>]
|
7
|
+
# @return [SmartCore::Operation::Success]
|
8
|
+
#
|
9
|
+
# @api public
|
10
|
+
# @since 0.5.2
|
11
|
+
def Success(**result_data) # rubocop:disable Naming/MethodName
|
12
|
+
SmartCore::Operation::Success.new(**result_data)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param errors [Array<Symbol|Any>]
|
16
|
+
# @return [SmartCore::Operation::Failure]
|
17
|
+
#
|
18
|
+
# @api public
|
19
|
+
# @since 0.5.2
|
20
|
+
def Failure(*errors) # rubocop:disable Naming/MethodName
|
21
|
+
SmartCore::Operation::Failure.new(*errors)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param errors [Array<Symbol|Any>]
|
25
|
+
# @return [SmartCore::Operation::Fatal]
|
26
|
+
#
|
27
|
+
# @raise [SmartCore::Operation::FatalError]
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
# @since 0.5.2
|
31
|
+
def Fatal(*errors) # rubocop:disable Naming/MethodName
|
32
|
+
raise SmartCore::Operation::Fatal.new(*errors)
|
33
|
+
end
|
34
|
+
end
|
data/lib/smart_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/smart_core/operation/fatal.rb
|
177
177
|
- lib/smart_core/operation/instance_builder.rb
|
178
178
|
- lib/smart_core/operation/result.rb
|
179
|
+
- lib/smart_core/operation/result_interface.rb
|
179
180
|
- lib/smart_core/operation/state.rb
|
180
181
|
- lib/smart_core/operation/step.rb
|
181
182
|
- lib/smart_core/operation/step_set.rb
|