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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b9327924b9bfe1b3e1bcfcf84d550d9b9128da1
4
- data.tar.gz: 5f9be969be455b38060313cf57defaaea7e6b330
3
+ metadata.gz: 2e53303de468775514b88a1a6dca64055f6bbade
4
+ data.tar.gz: 60c46b2e3808b67e8fc83b258dafe3edf6e9e9a7
5
5
  SHA512:
6
- metadata.gz: 8f1cdd23f90dd6b0a540511597d5873b7b15ab9b395ff6c983add20694ee5b99eaa85da1dd54102d3d8bbad09aca8fd17f238da3c05dfb2b81b32e71fd912314
7
- data.tar.gz: cb681e5628b28c3e9d0ba7979f8582379354fb4393113e50b5339803035c5509cdde3e6f34361606b2ef4211b4c98b6454adcc37265cd77e0d2d18e8948246fe
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
- .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
- .then_calculate_order_total
302
- .for { result_of_bagel }
303
- .and { result_of_coffee }
304
- .then_swipe_credit_card
305
- .returning_as_cc
306
- .then_pay
307
- .with_credit_card { result_of_cc }
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
@@ -49,7 +49,7 @@ module CarryOut
49
49
  end
50
50
 
51
51
  def unless(reference = nil, &block)
52
- self.if { |refs| !(reference || block).call(refs) }
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 { |guard| guard.call(artifacts) }.all?
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)
@@ -1,3 +1,3 @@
1
1
  module CarryOut
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carry_out
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Fields