subroutine 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/subroutine/op.rb +13 -10
- data/lib/subroutine/version.rb +1 -1
- data/test/support/ops.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db2163ce0bb2002f164e3bda2b19e7cd7946f04c
|
4
|
+
data.tar.gz: a6ec479f651d9d596f6dc7851c00b1c369e1c922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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)
|
data/lib/subroutine/version.rb
CHANGED
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
|
-
|
32
|
-
|
31
|
+
outputs :perform_called
|
32
|
+
outputs :perform_finished
|
33
33
|
|
34
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
225
|
+
outputs :foo
|
226
226
|
def perform
|
227
227
|
false
|
228
228
|
end
|