retry_once 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/retry_once.rb +16 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c6a9fab0f740fd879c5332bc9f352c5c5fce613
4
+ data.tar.gz: d2e5f3eee3f8c381455852138fce1e257f39383d
5
+ SHA512:
6
+ metadata.gz: f593d816990612758358c299d6e4546e28c401c53c34cf4d974e319b79b1243d4cf6a74218bfcd0b2fc85c706b0e7606a548b82338ca1775ce47765f59688a3a
7
+ data.tar.gz: bc5a8238f01e48d3a898114a8b9037ba61a93f925faa7eb91caa273ca7e58a7dd20bb79b6dd4ceab6d455f0de473d0b40c9c107277353ed0197b0aeb1fddc37b
data/lib/retry_once.rb ADDED
@@ -0,0 +1,16 @@
1
+ module Kernel
2
+ def retry_once_with(exception, proc_or_symbol, retried=false, &body)
3
+ begin
4
+ body.call
5
+ rescue exception
6
+ if not retried
7
+ if Symbol === proc_or_symbol
8
+ self.send(f)
9
+ else
10
+ proc_or_symbol.call
11
+ end
12
+ retry_once_with(exception, proc_or_symbol, true, &body)
13
+ end
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: retry_once
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jeroen Bulters
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Retry... but only once!
14
+ email:
15
+ - jeroen@bulte.rs
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/retry_once.rb
21
+ homepage: https://www.holder.nl
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.2.2
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Retry a block of code just once, rescue with another function
45
+ test_files: []
46
+ has_rdoc: