subroutine 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ce8addef08d4ac3a2acc33ebd1336e1acbeadf4
4
- data.tar.gz: 461466c26f1da36c13d468c2cdf7d7251b8ef7f6
3
+ metadata.gz: db2163ce0bb2002f164e3bda2b19e7cd7946f04c
4
+ data.tar.gz: a6ec479f651d9d596f6dc7851c00b1c369e1c922
5
5
  SHA512:
6
- metadata.gz: 3562274bd7a30c17d62530fd4ae8e7031326e44a2d2c6ac94fd329200bac3e9b20f3c13e4fa7aee9b50597b1fd3377fbf04a2f5fbc23978ccbb599ab3b2f30b1
7
- data.tar.gz: 0ac228d98a9cd17ff9b9dc33649eaaf434579e96c641b2e0560d45c602a98bfad6d04debe89cdf99b2c77aed9217d3657036dbfeb96921b09309888acedefbab
6
+ metadata.gz: c11cf049c0dfcf2abc8de33f5841df7fce0be49a3104fcbe99dc60bf08f50e3fab04c5c08145b9d7646185c374d39e8b8db4b837c41f10ea0be18a3d7dc3230a
7
+ data.tar.gz: 069dcc45c333d6754dcd787a87b8c384a588589673d22271804e3f4907c1ea9e1f0a303ceff2cfbcd77ebf45a9b333c849cf1a66fe8cfe6230f16cf02c5501ed
data/lib/subroutine/op.rb CHANGED
@@ -47,16 +47,19 @@ module Subroutine
47
47
 
48
48
  alias_method :fields, :field
49
49
 
50
- def output(name, options = {})
51
- self._outputs = self._outputs.merge({
52
- name.to_sym => DEFAULT_OUTPUT_OPTIONS.merge(options)
53
- })
54
-
55
- class_eval <<-EV, __FILE__, __LINE__ + 1
56
- def #{name}
57
- @outputs[:#{name}]
58
- end
59
- EV
50
+ def outputs(*names)
51
+ options = names.extract_options!
52
+ names.each do |name|
53
+ self._outputs = self._outputs.merge({
54
+ name.to_sym => DEFAULT_OUTPUT_OPTIONS.merge(options)
55
+ })
56
+
57
+ class_eval <<-EV, __FILE__, __LINE__ + 1
58
+ def #{name}
59
+ @outputs[:#{name}]
60
+ end
61
+ EV
62
+ end
60
63
  end
61
64
 
62
65
  def ignore_error(*field_names)
@@ -2,7 +2,7 @@ module Subroutine
2
2
 
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
data/test/support/ops.rb CHANGED
@@ -28,10 +28,10 @@ class SignupOp < ::Subroutine::Op
28
28
  validates :email, :presence => true
29
29
  validates :password, :presence => true
30
30
 
31
- output :perform_called
32
- output :perform_finished
31
+ outputs :perform_called
32
+ outputs :perform_finished
33
33
 
34
- output :created_user
34
+ outputs :created_user
35
35
 
36
36
  protected
37
37
 
@@ -208,21 +208,21 @@ class MissingOutputOp < ::Subroutine::Op
208
208
  end
209
209
 
210
210
  class MissingOutputSetOp < ::Subroutine::Op
211
- output :foo
211
+ outputs :foo
212
212
  def perform
213
213
  true
214
214
  end
215
215
  end
216
216
 
217
217
  class OutputNotRequiredOp < ::Subroutine::Op
218
- output :foo, required: false
218
+ outputs :foo, required: false
219
219
  def perform
220
220
  true
221
221
  end
222
222
  end
223
223
 
224
224
  class NoOutputNoSuccessOp < ::Subroutine::Op
225
- output :foo
225
+ outputs :foo
226
226
  def perform
227
227
  false
228
228
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson