lev 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmU1YjllMzk3Nzk1M2NhZmE5YzAxNWJmNWI2NDNmZTIwMWUwNTQ1Mw==
4
+ YTBiODNjMThhZGQwZTJiNjcxZTQyYjQ0NGJiZTIzOGEzMGQ4ZWMzNQ==
5
5
  data.tar.gz: !binary |-
6
- Nzc2NjI3MGNkNjVkYzljYmM3OGM1ZWE0NTIxMjI0OTExMzI4MzhlZg==
6
+ OTliM2JkYzdiZTYwNjZlNTlhZWJmYzY2ZTM3YzJmZDQzODczMDJmNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjVhYjY3MTU5YWMwMjhkMmNhMzgxZGFhOTUxYTdkMDA0NDhlNTY1YjJhMDA2
10
- Y2UwNTEyM2JkZDlkYzllNDlhYzQzNTFjZjI0MWRiZjZhYzIzN2JiMmU4YWEx
11
- N2M0N2EzYjNlNTBiNzZhZDI1OGIzZmIwNTljMWM4MTE2ZWY2NmU=
9
+ ZjYzMTZkNmUxNWE1OTI0ZWQwZmY5OGJjZDdiMjc2MGM4MmM2ZjQzNjkzN2E0
10
+ NjM1OGMwYzEwZWVmMTJhN2E4MzNmYmNmZWE2N2E3OTU1OGQ3YTJhYzAzZmM5
11
+ ZDgyODc4YThhZDRkYzJmZTMzZGNjZjhiMDU1NmVlOGYxMzc4N2I=
12
12
  data.tar.gz: !binary |-
13
- MDAzNDY3Y2YxNWIwYjM0MjM5YTU0OWZiMTUyODYzMGE2ZGYxYmQ2ZjEyNmYw
14
- YTkzMDNlYmZhMjM3Y2EyZDUyYzliYTZhY2YyZjgyMTMxYzBkNTY2MzdjMWRm
15
- ODI5Zjk5ZThlODI3ZTAxMzRhMzE5MjBkMWNiNmZkNDY1NGRmMDI=
13
+ ZmVkNGFlYTY3YjQ0ZjFkMjc1MmRhMmNlYTBmMTU5ODQzMGExNmQ1NGI3Mjlh
14
+ ZjdmYmE4OWU5YjY4ZGFlMjY5YTNkMzE4ZDFjMzliYTdjNzI2NmQyOWE2YTIx
15
+ YmJjYzc0NThhY2I4MWY1NzI4M2I2NTc5NWFlMmY2MzU4MGI1ZGU=
data/lib/lev/routine.rb CHANGED
@@ -233,12 +233,18 @@ module Lev
233
233
  attr_reader :runner
234
234
 
235
235
  def call(*args, &block)
236
+ @after_transaction_blocks = []
237
+
236
238
  in_transaction do
237
- catch :fatal_errors_encountered do
239
+ catch :fatal_errors_encountered do
238
240
  exec(*args, &block)
239
241
  end
240
242
  end
241
243
 
244
+ @after_transaction_blocks.each do |block|
245
+ block.call
246
+ end
247
+
242
248
  result
243
249
  end
244
250
 
@@ -362,6 +368,11 @@ module Lev
362
368
  ErrorTransferer.transfer(source, self, input_mapper, fail_if_errors)
363
369
  end
364
370
 
371
+ def add_after_transaction_block(block)
372
+ raise IllegalOperation if topmost_runner != self
373
+ @after_transaction_blocks.push(block)
374
+ end
375
+
365
376
  protected
366
377
 
367
378
  def result
@@ -378,6 +389,10 @@ module Lev
378
389
  runner.nil? ? self : runner.topmost_runner
379
390
  end
380
391
 
392
+ def after_transaction(&block)
393
+ topmost_runner.add_after_transaction_block(block)
394
+ end
395
+
381
396
  def runner=(runner)
382
397
  @runner = runner
383
398
 
data/lib/lev/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lev
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lev
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel