metaractor 1.1.0 → 1.2.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: 61aa5597f77391b54b18d7a7d31e6b3cef5d00c844702fc3e1ef06c2dc8b0b1d
4
- data.tar.gz: 5749efb4aa913aa4e4157e1213abedf689766add06df57544a41ac85aae47b0d
3
+ metadata.gz: fc495c71ac16ac1b8a355d83849f7f27b9980acb4f7fb36cf8da50773e73c4fc
4
+ data.tar.gz: 015a5f2abe0b5d1bd62ae5e685ec509f8b46ad29e4d2fa3dd5e9d98aae4db461
5
5
  SHA512:
6
- metadata.gz: 2c0d070919763827f78dee03c6667022faaf0b1882b65d527c1829f287b3ce7fa33efc91b8b55cb85e0edd1e808917b5d1b2e5d6833a151e33728b40f5df64d8
7
- data.tar.gz: a5969b17f7cbe5c2f447e5b43dca00662e6bf8cdf23f96414fb0257d1b4aec4eaf1c02899dbf06947f582739995e015830d06b3857a65d36cfb8c5a260d259d4
6
+ metadata.gz: 781c25b93c7b3cc8c645218ba0f7971389d86a1129ad1a62bd9930eb28b6a3413736917135c3bc6e8b4e803a7ad1664e12f7dfc6d133fa4c325e25696de75e36
7
+ data.tar.gz: fbbb9d96afed276d4a187255745b069dd7a18001e351934724d1b9122807300a844839ddee43112e74691b7ef314745de14b70b248d835ca31d3cdee20015908
data/README.md CHANGED
@@ -101,13 +101,13 @@ For more examples of all of the above approaches, please see the specs.
101
101
 
102
102
  ## Development
103
103
 
104
- - `docker build -t outstand/metaractor .`
105
- - `docker run -it --rm -v $(pwd):/metaractor outstand/metaractor` to run specs
104
+ - `docker-compose build --pull`
105
+ - `docker-compose run --rm metaractor` to run specs
106
106
 
107
107
  To release a new version:
108
108
  - Update the version number in `version.rb` and commit the result.
109
- - `docker build -t outstand/metaractor .`
110
- - `docker run -it --rm -v ~/.gitconfig:/home/metaractor/.gitconfig -v ~/.gitconfig.user:/home/metaractor/.gitconfig.user -v ~/.ssh/id_rsa:/home/metaractor/.ssh/id_rsa -v ~/.gem:/home/metaractor/.gem outstand/metaractor rake release`
109
+ - `docker-compose build --pull`
110
+ - `docker-compose run --rm release`
111
111
 
112
112
  ## Contributing
113
113
 
@@ -8,26 +8,41 @@ module Metaractor
8
8
  super
9
9
  end
10
10
 
11
- def fail_with_error!(message:)
12
- add_error(message: message)
11
+ def fail_with_error!(message: nil, **args)
12
+ add_error(message: message, **args)
13
13
  fail!
14
14
  end
15
15
 
16
- def fail_with_errors!(messages:)
17
- add_errors(messages: messages)
16
+ def fail_with_errors!(messages: [], errors: [])
17
+ add_errors(messages: messages, errors: errors)
18
18
  fail!
19
19
  end
20
20
 
21
- def add_error(message:)
22
- add_errors(messages: Array(message))
21
+ def add_error(message: nil, **args)
22
+ if message.nil?
23
+ add_errors(errors: [**args])
24
+ else
25
+ add_errors(messages: Array(message))
26
+ end
23
27
  end
24
28
 
25
- def add_errors(messages:)
29
+ def add_errors(messages: [], errors: [])
26
30
  self.errors += messages
31
+ self.errors += errors
27
32
  end
28
33
 
29
34
  def error_messages
30
- errors.join("\n")
35
+ errors.map do |error|
36
+ if error.respond_to?(:has_key?) && error.has_key?(:title)
37
+ if error[:source] != nil
38
+ "#{error[:source]}: #{error[:title]}"
39
+ else
40
+ error[:title].to_s
41
+ end
42
+ else
43
+ error.to_s
44
+ end
45
+ end.join("\n")
31
46
  end
32
47
  end
33
48
  end
@@ -1,3 +1,3 @@
1
1
  module Metaractor
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metaractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Schlesinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-18 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: interactor