mu-action 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +48 -0
- data/README.md +307 -32
- data/lib/mu/action/context.rb +36 -0
- data/lib/mu/action/failure_error.rb +30 -0
- data/lib/mu/action/failures.rb +149 -0
- data/lib/mu/action/hooks.rb +157 -0
- data/lib/mu/action/metadata.rb +123 -0
- data/lib/mu/action/result.rb +38 -0
- data/lib/mu/action/version.rb +1 -1
- data/lib/mu/action.rb +92 -351
- metadata +10 -5
- data/sig/mu/action.rbs +0 -159
data/sig/mu/action.rbs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
module Mu
|
|
2
|
-
module Action
|
|
3
|
-
include Kernel
|
|
4
|
-
|
|
5
|
-
VERSION: ::String
|
|
6
|
-
|
|
7
|
-
CONTEXT_KEY: Symbol
|
|
8
|
-
|
|
9
|
-
type failure_handler = :raise | ^(untyped action, untyped error, ::Hash[Symbol, untyped] details) -> untyped
|
|
10
|
-
type props_recording = bool | ::Hash[Symbol, ::Array[Symbol]]
|
|
11
|
-
|
|
12
|
-
module Configuration : Kernel
|
|
13
|
-
@on_undeclared_failure: failure_handler
|
|
14
|
-
|
|
15
|
-
def on_undeclared_failure: () -> failure_handler
|
|
16
|
-
def on_undeclared_failure=: (failure_handler handler) -> failure_handler
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
extend Configuration
|
|
20
|
-
attr_reader meta: ::Hash[untyped, untyped]
|
|
21
|
-
attr_reader context: untyped
|
|
22
|
-
|
|
23
|
-
interface _ActionInstance
|
|
24
|
-
def meta: () -> ::Hash[untyped, untyped]
|
|
25
|
-
def context: () -> untyped
|
|
26
|
-
def class: () -> _ActionClass
|
|
27
|
-
def run: () -> ::Mu::Action::Result
|
|
28
|
-
def run!: () -> ::Mu::Action::Result
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
interface _ActionClass
|
|
32
|
-
def literal_properties: () -> ::Array[untyped]
|
|
33
|
-
def before_hooks: () -> ::Array[untyped]
|
|
34
|
-
def after_hooks: () -> ::Array[untyped]
|
|
35
|
-
def around_hooks: () -> ::Array[untyped]
|
|
36
|
-
def declares_failures?: () -> bool
|
|
37
|
-
def failures: () -> ::Hash[untyped, ::Hash[Symbol, untyped]]
|
|
38
|
-
def failure_sources: () -> ::Array[_ActionClass]
|
|
39
|
-
def props_recording: () -> props_recording
|
|
40
|
-
def const_get: (Symbol) -> ::Class
|
|
41
|
-
def instance_method: (Symbol) -> UnboundMethod
|
|
42
|
-
def new: (*untyped, **untyped) -> _ActionInstance
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.included: (untyped base) -> void
|
|
46
|
-
def self.before_hooks: () -> ::Array[untyped]
|
|
47
|
-
def self.after_hooks: () -> ::Array[untyped]
|
|
48
|
-
def self.around_hooks: () -> ::Array[untyped]
|
|
49
|
-
|
|
50
|
-
module MetaPropAdder
|
|
51
|
-
include Literal::Properties
|
|
52
|
-
|
|
53
|
-
def new: (*untyped, **untyped) -> untyped
|
|
54
|
-
def inherited: (untyped subclass) -> void
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
module HookPropagator
|
|
58
|
-
def inherited: (untyped subclass) -> void
|
|
59
|
-
def before_hooks: () -> ::Array[untyped]
|
|
60
|
-
def after_hooks: () -> ::Array[untyped]
|
|
61
|
-
def around_hooks: () -> ::Array[untyped]
|
|
62
|
-
def own_failures: () -> ::Hash[untyped, ::Hash[Symbol, untyped]]
|
|
63
|
-
def failure_sources: () -> ::Array[_ActionClass]
|
|
64
|
-
def props_recording: () -> props_recording
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
class FailureError < StandardError
|
|
68
|
-
attr_reader error: untyped
|
|
69
|
-
attr_reader details: ::Hash[Symbol, untyped]
|
|
70
|
-
attr_reader failure: Failure?
|
|
71
|
-
|
|
72
|
-
def initialize: (untyped error, ?details: ::Hash[Symbol, untyped], ?failure: Failure?) -> void
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
class Result < Literal::Struct
|
|
76
|
-
attr_reader meta: ::Hash[untyped, untyped]
|
|
77
|
-
|
|
78
|
-
def initialize: (*untyped, **untyped) -> void
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
class Success < Result
|
|
82
|
-
attr_reader value: untyped
|
|
83
|
-
|
|
84
|
-
def initialize: (*untyped, **untyped) -> void
|
|
85
|
-
def success?: () -> true
|
|
86
|
-
def failure?: () -> false
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
class Failure < Result
|
|
90
|
-
attr_reader error: untyped
|
|
91
|
-
attr_reader details: ::Hash[Symbol, untyped]
|
|
92
|
-
|
|
93
|
-
def initialize: (*untyped, **untyped) -> void
|
|
94
|
-
def success?: () -> false
|
|
95
|
-
def failure?: () -> true
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
module Initializer : _ActionInstance
|
|
99
|
-
@meta: ::Hash[untyped, untyped]
|
|
100
|
-
|
|
101
|
-
def initialize: (*untyped, **untyped) -> void
|
|
102
|
-
def initialize_meta: () -> void
|
|
103
|
-
def recorded_props: () -> ::Hash[Symbol, untyped]?
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
module FailureChecking : _ActionInstance
|
|
107
|
-
def failure_from: (FailureError exception) -> Failure
|
|
108
|
-
def check_failure: (untyped error, ::Hash[Symbol, untyped] details, ?origin: untyped) -> void
|
|
109
|
-
def failure_problem: (untyped error, ::Hash[Symbol, untyped] details) -> ::String?
|
|
110
|
-
def detail_problem: (untyped error, ::Hash[Symbol, untyped] types, ::Hash[Symbol, untyped] details) -> ::String?
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
module ClassMethods
|
|
114
|
-
include Literal::Properties
|
|
115
|
-
|
|
116
|
-
def around: (*Symbol) ?{ (*untyped) -> untyped } -> ::Array[untyped]
|
|
117
|
-
def before: (*Symbol) ?{ (*untyped) -> untyped } -> ::Array[untyped]
|
|
118
|
-
def after: (*Symbol) ?{ (*untyped) -> untyped } -> ::Array[untyped]
|
|
119
|
-
def around_hooks: () -> ::Array[untyped]
|
|
120
|
-
def before_hooks: () -> ::Array[untyped]
|
|
121
|
-
def after_hooks: () -> ::Array[untyped]
|
|
122
|
-
def call: (*untyped, **untyped) -> untyped
|
|
123
|
-
def call!: (*untyped, **untyped) -> untyped
|
|
124
|
-
def result: (untyped type) -> ::Class
|
|
125
|
-
def failure: (*untyped codes, ?from: untyped, **untyped details) -> ::Array[_ActionClass]
|
|
126
|
-
def failures: () -> ::Hash[untyped, ::Hash[Symbol, untyped]]
|
|
127
|
-
def declares_failures?: () -> bool
|
|
128
|
-
def own_failures: () -> ::Hash[untyped, ::Hash[Symbol, untyped]]
|
|
129
|
-
def failure_sources: () -> ::Array[_ActionClass]
|
|
130
|
-
def record_props: (?bool enabled, ?only: (Symbol | ::Array[Symbol])?, ?except: (Symbol | ::Array[Symbol])?) -> props_recording
|
|
131
|
-
def props_recording: () -> props_recording
|
|
132
|
-
def build_props_recording: (bool enabled, (Symbol | ::Array[Symbol])? only, (Symbol | ::Array[Symbol])? except) -> props_recording
|
|
133
|
-
def register_hook: (untyped collection, untyped method_names, ::Proc? block, name: Symbol) -> untyped
|
|
134
|
-
def normalize_hook_inputs: (untyped method_names, ::Proc? block, name: Symbol) -> untyped
|
|
135
|
-
def ensure_valid_hook_inputs: (untyped method_names, ::Proc? block, name: Symbol) -> void
|
|
136
|
-
def symbolize_hook_names: (untyped method_names, name: Symbol) -> ::Array[Symbol]
|
|
137
|
-
def const_set: (Symbol, ::Class) -> ::Class
|
|
138
|
-
def new: (*untyped, **untyped) -> _ActionInstance
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def Success: (?untyped value) -> Success
|
|
142
|
-
def Failure: (untyped error, **untyped) -> bot
|
|
143
|
-
def run: () -> Result
|
|
144
|
-
def run!: () -> Result
|
|
145
|
-
def with_context: [T] () { () -> T } -> T
|
|
146
|
-
def failure_from: (FailureError exception) -> Failure
|
|
147
|
-
def check_failure: (untyped error, ::Hash[Symbol, untyped] details, ?origin: untyped) -> void
|
|
148
|
-
def with_hooks: () { () -> Result } -> Result
|
|
149
|
-
def run_before_hooks: () -> ::Array[untyped]
|
|
150
|
-
def run_after_hooks: () -> ::Array[untyped]
|
|
151
|
-
def build_around_chain: () { () -> Result } -> ::Proc
|
|
152
|
-
def execute_simple_hook: (::Proc | ::Symbol) -> untyped
|
|
153
|
-
def build_around_wrapper: ((::Proc | ::Symbol), ::Proc) -> ::Proc
|
|
154
|
-
def invoke_around_method: (::Symbol, ::Proc) -> untyped
|
|
155
|
-
def around_arguments: (UnboundMethod, ::Proc) -> ::Array[untyped]
|
|
156
|
-
def resolve_method: (Symbol) -> UnboundMethod
|
|
157
|
-
def call: () -> untyped
|
|
158
|
-
end
|
|
159
|
-
end
|