g2_command 0.3.0 → 0.4.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: c2c7e60893e03e11328bae24d2c98329695981f3fed89e1b4417f709db1588d3
4
- data.tar.gz: 76e183fefc48fd4de032d71eaf3f4028f48cec235f5adee52144420d61864b55
3
+ metadata.gz: 795f881d90230226f9ddb662080b9d8586474a3e42261129491c3c0b65f7e659
4
+ data.tar.gz: ca5199ed96e14da877e03fc026b3afd6dc503f2aeddd7c3111164f1d46c5b1c7
5
5
  SHA512:
6
- metadata.gz: 2fd05cfef8208fb26c5a472d35826ce438689699413f9016399a06112da1a3e304f2971bf325aee189b6f7838b5920678c895b0791f84e33b7dceafc0d87d403
7
- data.tar.gz: 241e6ea7df5db0beceb3f8548d81110d25212a92ae010d5ea0af5e5b90bf48c3b32fbc45b7ffbb283c3c852174aca76e01ae5ffec51ad3a16599ffb2e51f6aad
6
+ metadata.gz: 0d2f46c2cf70d1e008cc17ea2d0d7c2bc2dbdd22db0dbac5169b1f701a1e8da848c8c65c9e5bc357ea714bb1195713ae310be39a580508d0acb3998fa3cbfd7c
7
+ data.tar.gz: 3dfe50a69b515562937438cdb87c689a2bff3c5f2e0151a73530492385f9c4eab3bc7fc238cf0ac5581ebb4b2199c4e3d700d618dbb680cd4c8c7b7222e5b32d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- g2_command (0.3.0)
4
+ g2_command (0.4.0)
5
5
  activemodel (>= 6.0, < 7)
6
6
  activesupport (>= 6.0, < 7)
7
7
  dry-initializer (~> 3.0)
@@ -5,6 +5,7 @@ require 'active_model'
5
5
  require 'dry-initializer'
6
6
  require 'dry-monads'
7
7
 
8
+ require 'command/failure'
8
9
  require 'command/input_middleware'
9
10
  require 'command/interrupt'
10
11
 
@@ -34,13 +35,13 @@ module Command
34
35
  end
35
36
  end
36
37
 
37
- errors.empty? ? Success(result) : Failure(errors)
38
+ errors.empty? ? Success(result) : Failure(Command::Failure.new(result, errors))
38
39
  end
39
40
 
40
41
  def compose(command, *args)
41
42
  outcome = command.run(*args)
42
43
 
43
- raise Command::Interrupt, outcome.failure if outcome.failure?
44
+ raise Command::Interrupt, outcome.failure.errors if outcome.failure?
44
45
 
45
46
  outcome.value!
46
47
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Command
4
+ class Failure
5
+ attr_reader :result, :errors
6
+
7
+ def initialize(result, errors)
8
+ @result = result
9
+ @errors = errors
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Command
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g2_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -100,6 +100,7 @@ files:
100
100
  - bin/setup
101
101
  - g2_command.gemspec
102
102
  - lib/command.rb
103
+ - lib/command/failure.rb
103
104
  - lib/command/input_middleware.rb
104
105
  - lib/command/input_middleware/rails_params.rb
105
106
  - lib/command/input_middleware/symbolizer.rb