carry_out 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -16
- data/lib/carry_out/plan.rb +9 -2
- data/lib/carry_out/version.rb +1 -1
- 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: 2e53303de468775514b88a1a6dca64055f6bbade
|
4
|
+
data.tar.gz: 60c46b2e3808b67e8fc83b258dafe3edf6e9e9a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fd95432afa6c5784027248899e3d1c67950f6bdb5e2803dbc878982109a6d4ddcb6863a40367adcf8e27b4cebf39293e389cafe979f7179c6912c78885e0f04
|
7
|
+
data.tar.gz: bec723de2de174e99c49361051dd9954c357bab055044cee2f9ac109938bb30f350fa141dcbc58b4a0268f852a2ba7eb238d511d0c0ea3972441ab3b555ddcb2
|
data/README.md
CHANGED
@@ -289,22 +289,23 @@ While a contrived example, the following illustrates the improved readability of
|
|
289
289
|
```ruby
|
290
290
|
plan = CarryOut
|
291
291
|
.within_order_transaction
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
.
|
302
|
-
|
303
|
-
|
304
|
-
.
|
305
|
-
|
306
|
-
.
|
307
|
-
|
292
|
+
.will_order_bagel
|
293
|
+
.flavored('everything')
|
294
|
+
.toasted
|
295
|
+
.topped_with('butter')
|
296
|
+
.and('strawberry cream cheese')
|
297
|
+
.returning_as_bagel
|
298
|
+
.then_order_coffee
|
299
|
+
.with_cream
|
300
|
+
.and_sugar
|
301
|
+
.returning_as_coffee
|
302
|
+
.then_calculate_order_total
|
303
|
+
.for { result_of_bagel }
|
304
|
+
.and { result_of_coffee }
|
305
|
+
.then_swipe_credit_card
|
306
|
+
.returning_as_cc
|
307
|
+
.then_pay
|
308
|
+
.with_credit_card { result_of_cc }
|
308
309
|
```
|
309
310
|
|
310
311
|
## Motivation
|
data/lib/carry_out/plan.rb
CHANGED
@@ -49,7 +49,7 @@ module CarryOut
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def unless(reference = nil, &block)
|
52
|
-
self.if { |refs| !(reference || block)
|
52
|
+
self.if { |refs| !self.instance_exec(refs, &(reference || block)) }
|
53
53
|
|
54
54
|
self
|
55
55
|
end
|
@@ -143,8 +143,15 @@ module CarryOut
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def guard_node(node, artifacts)
|
146
|
+
context = Context.new(artifacts)
|
146
147
|
guards = node_meta(node)[:guards]
|
147
|
-
guards.nil? || guards.map
|
148
|
+
guards.nil? || guards.map do |guard|
|
149
|
+
if guard.kind_of?(CarryOut::Reference)
|
150
|
+
reference_proc = -> (refs) { guard.call(refs) }
|
151
|
+
end
|
152
|
+
|
153
|
+
context.instance_exec(artifacts, &(reference_proc || guard))
|
154
|
+
end.all?
|
148
155
|
end
|
149
156
|
|
150
157
|
def key_for_node(node)
|
data/lib/carry_out/version.rb
CHANGED