g2_command 0.2.0 → 0.3.0

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: f13db20c39897ba62b772df83fa08669c50ed453e4986de8e212a150d8beed8d
4
- data.tar.gz: 1201c0befff3595658f299b527cea3116c2a7d6717197c0e3c091b2165999217
3
+ metadata.gz: c2c7e60893e03e11328bae24d2c98329695981f3fed89e1b4417f709db1588d3
4
+ data.tar.gz: 76e183fefc48fd4de032d71eaf3f4028f48cec235f5adee52144420d61864b55
5
5
  SHA512:
6
- metadata.gz: 30a07c7dbbc9918c729e49bd539202209f162367f57a2e4bdd3f65a899bce59ad0f726e342b2f4caa3aeb30c71f8dc94d6846fab0f8452b976a1262ce530d97c
7
- data.tar.gz: a7a1011d0dd407c4873cbc533f151abd87bf35fa25d1e02915f9f0cc400aa20c626d3dd29a850747f5a4959714e2d47af3d66ee485f3c4e54cf625e2af6f9b46
6
+ metadata.gz: 2fd05cfef8208fb26c5a472d35826ce438689699413f9016399a06112da1a3e304f2971bf325aee189b6f7838b5920678c895b0791f84e33b7dceafc0d87d403
7
+ data.tar.gz: 241e6ea7df5db0beceb3f8548d81110d25212a92ae010d5ea0af5e5b90bf48c3b32fbc45b7ffbb283c3c852174aca76e01ae5ffec51ad3a16599ffb2e51f6aad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- g2_command (0.2.0)
4
+ g2_command (0.3.0)
5
5
  activemodel (>= 6.0, < 7)
6
6
  activesupport (>= 6.0, < 7)
7
7
  dry-initializer (~> 3.0)
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(normalize_inputs(inputs)).run
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Command
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g2_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari