codequest_pipes 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
  SHA1:
3
- metadata.gz: 5de4743e4f4364742d5f485f244167f604394777
4
- data.tar.gz: 76c3e6315db9137dac15c76a0263b177855295c3
3
+ metadata.gz: 8927148db159660b6ead2c27a563bad7549d0a09
4
+ data.tar.gz: 19984aa1944dcfeb4f25f98a4e094d7d7a30d726
5
5
  SHA512:
6
- metadata.gz: f5059e69133b70d4c618334e1fef64eb603e54b90e86df911ed22aa4b7f05a61542089d85f86d42f22789ece92ff0ccf9e83ddcb69cc94af27da479fe2bc4660
7
- data.tar.gz: b3589d64194030087e2df1a7115e65956683a4b55e4dfcfde8b144aa320c27139baaa897efce8743c38b30c399d1598759f7db9e41d9e8852db0da8c9da5a07d
6
+ metadata.gz: c21098b3a8f6a3c58fe20b811601a242a2cbec7804ddc238033d7098cd9b8dd37d4d51889329408e998f32c9f2a5dacc57d99af852ee3519c16f7171c1639e39
7
+ data.tar.gz: 42650f5652b26974040cda7f82db6860c09d69f616ecc3a2bf378947df5735e3304a5843023f09983373ab17c5825329655309e3728bbfc008807b15882bd328
data/README.md CHANGED
@@ -4,11 +4,10 @@ Pipes provide a Unix-like way to chain business objects (interactors) in Ruby.
4
4
 
5
5
  ## Installation
6
6
 
7
- To start using Pipes, add the library to your Gemfile. This project is currently
8
- not available on RubyGems.
7
+ To start using Pipes, add the library to your `Gemfile` and run `bundle install`.
9
8
 
10
9
  ```ruby
11
- gem "codequest_pipes", github: "codequest-eu/codequest_pipes"
10
+ gem 'codequest_pipes'
12
11
  ```
13
12
 
14
13
  ## High-level usage example
@@ -45,7 +44,7 @@ Note how we've only had to implement the `call` method for the magic to start ha
45
44
 
46
45
  Each Pipe requires an instance `Pipes::Context` to be passed on `.call` invokation. It provides append-only data container for Pipes: you can add data to a context at any time using the `add` method but the same call will raise an error if you try to modify an existing key.
47
46
 
48
- Made with <3 by [code quest](http://www.codequest.com)
47
+ Made with ❤️ by [code quest](http://www.codequest.com)
49
48
 
50
49
 
51
50
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'codequest_pipes'
5
- spec.version = '0.2.0'
5
+ spec.version = '0.3.0'
6
6
 
7
7
  spec.author = 'codequest'
8
8
  spec.email = 'hello@codequest.com'
@@ -14,6 +14,6 @@ Gem::Specification.new do |spec|
14
14
  spec.files = `git ls-files`.split($RS)
15
15
  spec.test_files = spec.files.grep(/^spec/)
16
16
 
17
- spec.add_development_dependency 'bundler', '>= 1.6.9'
17
+ spec.add_development_dependency 'bundler', '~> 1.6', '>= 1.6.9'
18
18
  spec.add_development_dependency 'rake', '~> 10.3'
19
19
  end
@@ -32,6 +32,14 @@ module Pipes
32
32
  end
33
33
  end
34
34
 
35
+ # Quietly fail the pipe, allowing the error to be saved and accessed from
36
+ # the Context.
37
+ #
38
+ # @param error [Any] Error to be set.
39
+ def halt(error = 'Execution stopped')
40
+ @error = error
41
+ end
42
+
35
43
  # Explicitly fail the pipe, allowing the error to be saved and accessed from
36
44
  # the Context.
37
45
  #
@@ -39,7 +47,7 @@ module Pipes
39
47
  #
40
48
  # @raise [ExecutionTerminated]
41
49
  def terminate(error)
42
- @error = error
50
+ halt(error)
43
51
  fail ExecutionTerminated, error
44
52
  end
45
53
 
@@ -20,10 +20,10 @@ module Pipes
20
20
  end
21
21
 
22
22
  def self.call(ctx)
23
+ return ctx if ctx.error
23
24
  _validate_ctx(_required_context_elements, ctx)
24
25
  new(ctx).call
25
26
  _validate_ctx(_provided_context_elements, ctx)
26
- ctx
27
27
  end
28
28
 
29
29
  def self.require_context(*args)
metadata CHANGED
@@ -1,19 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codequest_pipes
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
  - codequest
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-13 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 1.6.9
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 1.6.9