tins 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/VERSION +1 -1
- data/lib/tins/version.rb +1 -1
- data/tests/attempt_test.rb +48 -0
- data/tests/subhash_test.rb +8 -0
- data/tins.gemspec +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e8a0b467a8afe09dfacf9d3e863095bbff4f62
|
4
|
+
data.tar.gz: 705758796fb07e53051e10824e83f4e96470ac2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d8bab15a5bbd2970f846fce5151ec1556f2ee9e2f2b22193993da504af5590511bb266b39066874ad470198c6ad7112e77dab1b486eb49baf3cd687feab558
|
7
|
+
data.tar.gz: 8e629177458dc5a6dc51ee109c929e0c70f677b2ec46db77b4c61da149ebfa17b0c4a5180e3c75146a0c28baafa84f1b87a0fac5d1fbb8fdf50bf2b426e4b900
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.13.
|
1
|
+
0.13.2
|
data/lib/tins/version.rb
CHANGED
data/tests/attempt_test.rb
CHANGED
@@ -39,5 +39,53 @@ module Tins
|
|
39
39
|
end
|
40
40
|
assert_equal 3, tries
|
41
41
|
end
|
42
|
+
|
43
|
+
def test_reraise_exception_with_numeric_sleep
|
44
|
+
tries = 0
|
45
|
+
singleton_class.class_eval do
|
46
|
+
define_method(:sleep_duration) do |duration, count|
|
47
|
+
assert_equal 10, duration
|
48
|
+
tries = count
|
49
|
+
super 0, count # Let's not really sleep that long…
|
50
|
+
end
|
51
|
+
end
|
52
|
+
assert_raise(MyException) do
|
53
|
+
attempt(:attempts => 3, :exception_class => MyException, :reraise => true, :sleep => 10) do |c|
|
54
|
+
raise MyException
|
55
|
+
end
|
56
|
+
end
|
57
|
+
assert_equal 2, tries
|
58
|
+
ensure
|
59
|
+
singleton_class.class_eval do
|
60
|
+
method_defined?(:sleep_duration) and remove_method :sleep_duration
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_reraise_exception_with_proc_sleep
|
65
|
+
tries = 0
|
66
|
+
singleton_class.class_eval do
|
67
|
+
define_method(:sleep_duration) do |duration, count|
|
68
|
+
assert_kind_of Proc, duration
|
69
|
+
tries = count
|
70
|
+
super duration, count
|
71
|
+
end
|
72
|
+
end
|
73
|
+
assert_raise(MyException) do
|
74
|
+
attempt(:attempts => 3, :exception_class => MyException, :reraise => true, :sleep => lambda { |x| 0 }) do |c|
|
75
|
+
raise MyException
|
76
|
+
end
|
77
|
+
end
|
78
|
+
assert_equal 2, tries
|
79
|
+
ensure
|
80
|
+
singleton_class.class_eval do
|
81
|
+
method_defined?(:sleep_duration) and remove_method :sleep_duration
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def singleton_class
|
88
|
+
class << self; self; end
|
89
|
+
end unless method_defined?(:singleton_class)
|
42
90
|
end
|
43
91
|
end
|
data/tests/subhash_test.rb
CHANGED
@@ -25,5 +25,13 @@ module Tins
|
|
25
25
|
assert_equal [ [ 'foo1', 1 ], [ 'foo2', 2 ] ],
|
26
26
|
h.subhash(/\Afoo(\d)/) { |_,_,m| Integer(m[1]) }.to_a.sort
|
27
27
|
end
|
28
|
+
|
29
|
+
def test_subhash_with_default_proc
|
30
|
+
h = Hash.new { |h, k| h[k] = :foo }
|
31
|
+
h.update('foo' => 1, 'bar' => 2)
|
32
|
+
s = h.subhash('foo')
|
33
|
+
assert_equal 1, s['foo']
|
34
|
+
assert_equal :foo, s['bar']
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
data/tins.gemspec
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: tins 0.13.
|
2
|
+
# stub: tins 0.13.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "tins"
|
6
|
-
s.version = "0.13.
|
6
|
+
s.version = "0.13.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
9
10
|
s.authors = ["Florian Frank"]
|
10
|
-
s.date = "
|
11
|
+
s.date = "2014-02-02"
|
11
12
|
s.description = "All the stuff that isn't good/big enough for a real library."
|
12
13
|
s.email = "flori@ping.de"
|
13
14
|
s.extra_rdoc_files = ["README.rdoc", "lib/spruz.rb", "lib/tins.rb", "lib/tins/alias.rb", "lib/tins/annotate.rb", "lib/tins/ask_and_send.rb", "lib/tins/attempt.rb", "lib/tins/bijection.rb", "lib/tins/concern.rb", "lib/tins/count_by.rb", "lib/tins/date_dummy.rb", "lib/tins/date_time_dummy.rb", "lib/tins/deep_const_get.rb", "lib/tins/deep_dup.rb", "lib/tins/extract_last_argument_options.rb", "lib/tins/file_binary.rb", "lib/tins/find.rb", "lib/tins/generator.rb", "lib/tins/go.rb", "lib/tins/hash_symbolize_keys_recursive.rb", "lib/tins/hash_union.rb", "lib/tins/if_predicate.rb", "lib/tins/limited.rb", "lib/tins/lines_file.rb", "lib/tins/memoize.rb", "lib/tins/method_description.rb", "lib/tins/minimize.rb", "lib/tins/module_group.rb", "lib/tins/named_set.rb", "lib/tins/null.rb", "lib/tins/once.rb", "lib/tins/p.rb", "lib/tins/partial_application.rb", "lib/tins/proc_compose.rb", "lib/tins/proc_prelude.rb", "lib/tins/range_plus.rb", "lib/tins/require_maybe.rb", "lib/tins/responding.rb", "lib/tins/rotate.rb", "lib/tins/round.rb", "lib/tins/secure_write.rb", "lib/tins/sexy_singleton.rb", "lib/tins/shuffle.rb", "lib/tins/string_byte_order_mark.rb", "lib/tins/string_camelize.rb", "lib/tins/string_underscore.rb", "lib/tins/string_version.rb", "lib/tins/subhash.rb", "lib/tins/terminal.rb", "lib/tins/time_dummy.rb", "lib/tins/to.rb", "lib/tins/to_proc.rb", "lib/tins/token.rb", "lib/tins/uniq_by.rb", "lib/tins/version.rb", "lib/tins/write.rb", "lib/tins/xt.rb", "lib/tins/xt/annotate.rb", "lib/tins/xt/ask_and_send.rb", "lib/tins/xt/attempt.rb", "lib/tins/xt/blank.rb", "lib/tins/xt/concern.rb", "lib/tins/xt/count_by.rb", "lib/tins/xt/date_dummy.rb", "lib/tins/xt/date_time_dummy.rb", "lib/tins/xt/deep_const_get.rb", "lib/tins/xt/deep_dup.rb", "lib/tins/xt/extract_last_argument_options.rb", "lib/tins/xt/file_binary.rb", "lib/tins/xt/full.rb", "lib/tins/xt/hash_symbolize_keys_recursive.rb", "lib/tins/xt/hash_union.rb", "lib/tins/xt/if_predicate.rb", "lib/tins/xt/irb.rb", "lib/tins/xt/method_description.rb", "lib/tins/xt/named.rb", "lib/tins/xt/null.rb", "lib/tins/xt/p.rb", "lib/tins/xt/partial_application.rb", "lib/tins/xt/proc_compose.rb", "lib/tins/xt/proc_prelude.rb", "lib/tins/xt/range_plus.rb", "lib/tins/xt/require_maybe.rb", "lib/tins/xt/responding.rb", "lib/tins/xt/rotate.rb", "lib/tins/xt/round.rb", "lib/tins/xt/secure_write.rb", "lib/tins/xt/sexy_singleton.rb", "lib/tins/xt/shuffle.rb", "lib/tins/xt/string.rb", "lib/tins/xt/string_byte_order_mark.rb", "lib/tins/xt/string_camelize.rb", "lib/tins/xt/string_underscore.rb", "lib/tins/xt/string_version.rb", "lib/tins/xt/subhash.rb", "lib/tins/xt/symbol_to_proc.rb", "lib/tins/xt/time_dummy.rb", "lib/tins/xt/to.rb", "lib/tins/xt/uniq_by.rb", "lib/tins/xt/write.rb"]
|
@@ -15,10 +16,9 @@ Gem::Specification.new do |s|
|
|
15
16
|
s.homepage = "http://flori.github.com/tins"
|
16
17
|
s.licenses = ["MIT"]
|
17
18
|
s.rdoc_options = ["--title", "Tins - Useful stuff.", "--main", "README.rdoc"]
|
18
|
-
s.
|
19
|
-
s.rubygems_version = "2.1.10"
|
19
|
+
s.rubygems_version = "2.2.1"
|
20
20
|
s.summary = "Useful stuff."
|
21
|
-
s.test_files = ["tests/annotate_test.rb", "tests/ask_and_send_test.rb", "tests/attempt_test.rb", "tests/bijection_test.rb", "tests/blank_full_test.rb", "tests/concern_test.rb", "tests/count_by_test.rb", "tests/date_dummy_test.rb", "tests/date_time_dummy_test.rb", "tests/deep_const_get_test.rb", "tests/deep_dup_test.rb", "tests/extract_last_argument_options_test.rb", "tests/file_binary_test.rb", "tests/find_test.rb", "tests/generator_test.rb", "tests/go_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/hash_union_test.rb", "tests/if_predicate_test.rb", "tests/limited_test.rb", "tests/lines_file_test.rb", "tests/memoize_test.rb", "tests/method_description_test.rb", "tests/minimize_test.rb", "tests/module_group_test.rb", "tests/named_set_test.rb", "tests/named_test.rb", "tests/null_test.rb", "tests/p_test.rb", "tests/partial_application_test.rb", "tests/proc_compose_test.rb", "tests/proc_prelude_test.rb", "tests/range_plus_test.rb", "tests/require_maybe_test.rb", "tests/responding_test.rb", "tests/rotate_test.rb", "tests/round_test.rb", "tests/secure_write_test.rb", "tests/sexy_singleton_test.rb", "tests/shuffle_test.rb", "tests/string_byte_order_mark_test.rb", "tests/string_camelize_test.rb", "tests/string_underscore_test.rb", "tests/string_version_test.rb", "tests/subhash_test.rb", "tests/test_helper.rb", "tests/time_dummy_test.rb", "tests/to_test.rb", "tests/token_test.rb", "tests/uniq_by_test.rb", "tests/
|
21
|
+
s.test_files = ["tests/annotate_test.rb", "tests/ask_and_send_test.rb", "tests/attempt_test.rb", "tests/bijection_test.rb", "tests/blank_full_test.rb", "tests/concern_test.rb", "tests/count_by_test.rb", "tests/date_dummy_test.rb", "tests/date_time_dummy_test.rb", "tests/deep_const_get_test.rb", "tests/deep_dup_test.rb", "tests/extract_last_argument_options_test.rb", "tests/file_binary_test.rb", "tests/find_test.rb", "tests/generator_test.rb", "tests/go_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/hash_union_test.rb", "tests/if_predicate_test.rb", "tests/limited_test.rb", "tests/lines_file_test.rb", "tests/memoize_test.rb", "tests/method_description_test.rb", "tests/minimize_test.rb", "tests/module_group_test.rb", "tests/named_set_test.rb", "tests/named_test.rb", "tests/null_test.rb", "tests/p_test.rb", "tests/partial_application_test.rb", "tests/proc_compose_test.rb", "tests/proc_prelude_test.rb", "tests/range_plus_test.rb", "tests/require_maybe_test.rb", "tests/responding_test.rb", "tests/rotate_test.rb", "tests/round_test.rb", "tests/secure_write_test.rb", "tests/sexy_singleton_test.rb", "tests/shuffle_test.rb", "tests/string_byte_order_mark_test.rb", "tests/string_camelize_test.rb", "tests/string_underscore_test.rb", "tests/string_version_test.rb", "tests/subhash_test.rb", "tests/test_helper.rb", "tests/time_dummy_test.rb", "tests/to_test.rb", "tests/token_test.rb", "tests/uniq_by_test.rb", "tests/sexy_singleton_test.rb", "tests/generator_test.rb", "tests/null_test.rb", "tests/find_test.rb", "tests/attempt_test.rb", "tests/proc_prelude_test.rb", "tests/date_time_dummy_test.rb", "tests/range_plus_test.rb", "tests/deep_dup_test.rb", "tests/method_description_test.rb", "tests/bijection_test.rb", "tests/concern_test.rb", "tests/memoize_test.rb", "tests/limited_test.rb", "tests/count_by_test.rb", "tests/blank_full_test.rb", "tests/deep_const_get_test.rb", "tests/file_binary_test.rb", "tests/named_set_test.rb", "tests/if_predicate_test.rb", "tests/p_test.rb", "tests/string_byte_order_mark_test.rb", "tests/annotate_test.rb", "tests/proc_compose_test.rb", "tests/secure_write_test.rb", "tests/string_version_test.rb", "tests/extract_last_argument_options_test.rb", "tests/require_maybe_test.rb", "tests/uniq_by_test.rb", "tests/time_dummy_test.rb", "tests/string_camelize_test.rb", "tests/lines_file_test.rb", "tests/string_underscore_test.rb", "tests/date_dummy_test.rb", "tests/hash_symbolize_keys_recursive_test.rb", "tests/named_test.rb", "tests/hash_union_test.rb", "tests/responding_test.rb", "tests/to_test.rb", "tests/go_test.rb", "tests/subhash_test.rb", "tests/partial_application_test.rb", "tests/minimize_test.rb", "tests/round_test.rb", "tests/shuffle_test.rb", "tests/token_test.rb", "tests/ask_and_send_test.rb", "tests/module_group_test.rb", "tests/rotate_test.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 4
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -340,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
340
340
|
version: '0'
|
341
341
|
requirements: []
|
342
342
|
rubyforge_project:
|
343
|
-
rubygems_version: 2.1
|
343
|
+
rubygems_version: 2.2.1
|
344
344
|
signing_key:
|
345
345
|
specification_version: 4
|
346
346
|
summary: Useful stuff.
|