g2_command 0.2.0 → 0.3.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/Gemfile.lock +1 -1
- data/lib/command.rb +7 -7
- data/lib/command/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2c7e60893e03e11328bae24d2c98329695981f3fed89e1b4417f709db1588d3
|
|
4
|
+
data.tar.gz: 76e183fefc48fd4de032d71eaf3f4028f48cec235f5adee52144420d61864b55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2fd05cfef8208fb26c5a472d35826ce438689699413f9016399a06112da1a3e304f2971bf325aee189b6f7838b5920678c895b0791f84e33b7dceafc0d87d403
|
|
7
|
+
data.tar.gz: 241e6ea7df5db0beceb3f8548d81110d25212a92ae010d5ea0af5e5b90bf48c3b32fbc45b7ffbb283c3c852174aca76e01ae5ffec51ad3a16599ffb2e51f6aad
|
data/Gemfile.lock
CHANGED
data/lib/command.rb
CHANGED
|
@@ -11,11 +11,16 @@ require 'command/interrupt'
|
|
|
11
11
|
module Command
|
|
12
12
|
extend ActiveSupport::Concern
|
|
13
13
|
|
|
14
|
+
# rubocop:disable Metrics/BlockLength
|
|
14
15
|
included do
|
|
15
16
|
extend Dry::Initializer
|
|
16
17
|
include Dry::Monads[:result]
|
|
17
18
|
include ActiveModel::Validations
|
|
18
19
|
|
|
20
|
+
def initialize(inputs = {})
|
|
21
|
+
super(Command::InputMiddleware.call(inputs))
|
|
22
|
+
end
|
|
23
|
+
|
|
19
24
|
def execute
|
|
20
25
|
raise NotImplementedError
|
|
21
26
|
end
|
|
@@ -44,20 +49,15 @@ module Command
|
|
|
44
49
|
self.class.dry_initializer.attributes(self)
|
|
45
50
|
end
|
|
46
51
|
end
|
|
52
|
+
# rubocop:enable Metrics/BlockLength
|
|
47
53
|
|
|
48
54
|
class_methods do
|
|
49
55
|
def run(inputs = {})
|
|
50
|
-
new(
|
|
56
|
+
new(inputs).run
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def run!(inputs = {})
|
|
54
60
|
run(inputs).value!
|
|
55
61
|
end
|
|
56
|
-
|
|
57
|
-
private
|
|
58
|
-
|
|
59
|
-
def normalize_inputs(inputs)
|
|
60
|
-
Command::InputMiddleware.call(inputs)
|
|
61
|
-
end
|
|
62
62
|
end
|
|
63
63
|
end
|
data/lib/command/version.rb
CHANGED