tins 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tins/method_description.rb +1 -1
- data/lib/tins/version.rb +1 -1
- data/tests/method_description_test.rb +53 -51
- data/tests/named_test.rb +11 -13
- data/tests/proc_compose_test.rb +1 -5
- data/tins.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 675d8fe4f6eb2760a8c612aa8e866b0a56a03592
|
4
|
+
data.tar.gz: 6d2365de9f550d6a4d4a5e0c5448b072f872c7fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9596699ef22176c269d02b31ba2adef456e11cc4cd27a04e9c9fd7007019d835b34222ebc5eba3f89a39f0e2ea2bb43fbea6a6c805fdf04d5889a7e431d31709
|
7
|
+
data.tar.gz: 2eb308a13aa44d00e3458c2f180017320f977187a3934e6e7abd20038a581bbc9e4a479a8fbddbff197a9e7375d2b56b2b5f822b095b15d06ba293c63efb4153
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.2
|
data/lib/tins/version.rb
CHANGED
@@ -1,73 +1,75 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'tins/xt'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
def foo
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.foo
|
12
|
-
end
|
4
|
+
module Tins
|
5
|
+
class MethodDescriptionTest < Test::Unit::TestCase
|
6
|
+
class A
|
7
|
+
def foo
|
13
8
|
end
|
14
9
|
|
15
|
-
def
|
16
|
-
assert_equal 'Tins::MethodDescriptionTest::A#foo()', A.instance_method(:foo).to_s
|
17
|
-
assert_equal '#<UnboundMethod: Tins::MethodDescriptionTest::A#foo()>', A.instance_method(:foo).inspect
|
18
|
-
assert_equal 'Tins::MethodDescriptionTest::A.foo()', A.method(:foo).to_s
|
19
|
-
assert_equal '#<Method: Tins::MethodDescriptionTest::A.foo()>', A.method(:foo).inspect
|
10
|
+
def self.foo
|
20
11
|
end
|
12
|
+
end
|
21
13
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
def test_static_nonstatic
|
15
|
+
assert_equal 'Tins::MethodDescriptionTest::A#foo()', A.instance_method(:foo).to_s
|
16
|
+
assert_equal '#<UnboundMethod: Tins::MethodDescriptionTest::A#foo()>', A.instance_method(:foo).inspect
|
17
|
+
assert_equal 'Tins::MethodDescriptionTest::A.foo()', A.method(:foo).to_s
|
18
|
+
assert_equal '#<Method: Tins::MethodDescriptionTest::A.foo()>', A.method(:foo).inspect
|
19
|
+
end
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
B.instance_method(:foo).to_s
|
21
|
+
class B
|
22
|
+
def foo(x, y = 1, *r, &b)
|
30
23
|
end
|
24
|
+
end
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
def test_standard_parameters_namespace
|
27
|
+
assert_equal 'Tins::MethodDescriptionTest::B#foo(x,y=?,*r,&b)',
|
28
|
+
B.instance_method(:foo).to_s
|
29
|
+
end
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
def test_standard_parameters_name
|
32
|
+
assert_equal 'foo(x,y=?,*r,&b)',
|
33
|
+
B.instance_method(:foo).description(style: :name)
|
34
|
+
end
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
36
|
+
def test_standard_parameters_parameters
|
37
|
+
assert_equal 'x,y=?,*r,&b',
|
38
|
+
B.instance_method(:foo).description(style: :parameters)
|
39
|
+
end
|
47
40
|
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
def test_a_cstyle_method_from_hash
|
42
|
+
assert_equal "Hash#store(x1,x2)", ({}.method(:store).description)
|
43
|
+
end
|
51
44
|
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
if RUBY_VERSION >= "2.0"
|
46
|
+
eval %{
|
47
|
+
class C
|
48
|
+
def foo(x, k: true, &b)
|
55
49
|
end
|
56
|
-
}
|
57
|
-
end
|
58
50
|
|
59
|
-
|
60
|
-
eval %{
|
61
|
-
class D
|
62
|
-
def foo(x, k:, &b)
|
63
|
-
end
|
51
|
+
def bar(x, **k, &b)
|
64
52
|
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_keyword_parameters
|
56
|
+
assert_equal 'Tins::MethodDescriptionTest::C#foo(x,k:?,&b)', C.instance_method(:foo).to_s
|
57
|
+
assert_equal 'Tins::MethodDescriptionTest::C#bar(x,**k,&b)', C.instance_method(:bar).to_s
|
58
|
+
end
|
59
|
+
}
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
62
|
+
if RUBY_VERSION >= "2.1"
|
63
|
+
eval %{
|
64
|
+
class D
|
65
|
+
def foo(x, k:, &b)
|
68
66
|
end
|
69
|
-
|
70
|
-
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_keyword_parameters_required
|
70
|
+
assert_equal 'Tins::MethodDescriptionTest::D#foo(x,k:,&b)', D.instance_method(:foo).to_s
|
71
|
+
end
|
72
|
+
}
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
data/tests/named_test.rb
CHANGED
@@ -12,21 +12,19 @@ module Tins
|
|
12
12
|
assert_equal [ 3 ], a.plus1.odd
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
def foo(x, y, &block)
|
16
|
+
block.call x * y
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
assert_equal foo(2, 3) { |z| z ** 2 }, foo_with_block(2, 3)
|
25
|
-
Object.named(:foo_23, :foo, 2, 3)
|
26
|
-
assert_equal foo(2, 3) { |z| z ** 2 }, foo_23 { |z| z ** 2 }
|
27
|
-
Object.named(:foo_2, :foo, 2)
|
28
|
-
assert_equal foo(2, 3) { |z| z ** 2 }, foo_2(3) { |z| z ** 2 }
|
19
|
+
def test_more_complex
|
20
|
+
Object.named(:foo_with_block, :foo) do |z|
|
21
|
+
z ** 2
|
29
22
|
end
|
23
|
+
assert_equal foo(2, 3) { |z| z ** 2 }, foo_with_block(2, 3)
|
24
|
+
Object.named(:foo_23, :foo, 2, 3)
|
25
|
+
assert_equal foo(2, 3) { |z| z ** 2 }, foo_23 { |z| z ** 2 }
|
26
|
+
Object.named(:foo_2, :foo, 2)
|
27
|
+
assert_equal foo(2, 3) { |z| z ** 2 }, foo_2(3) { |z| z ** 2 }
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
data/tests/proc_compose_test.rb
CHANGED
@@ -13,11 +13,7 @@ module Tins
|
|
13
13
|
def test_proc_compose_more_complex
|
14
14
|
f = lambda { |x, y| 2 * x + y * 3 }
|
15
15
|
g = lambda { |x| x + 1 }
|
16
|
-
|
17
|
-
assert_raise(ArgumentError) { (f * g).call(2, 3) }
|
18
|
-
else
|
19
|
-
assert_raise(TypeError) { (f * g).call(2, 3) }
|
20
|
-
end
|
16
|
+
assert_raise(ArgumentError) { (f * g).call(2, 3) }
|
21
17
|
d = lambda { |x| [ x, x ] }
|
22
18
|
assert_equal 15, (f * d * g).call(2)
|
23
19
|
end
|
data/tins.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: tins 1.5.
|
2
|
+
# stub: tins 1.5.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "tins"
|
6
|
-
s.version = "1.5.
|
6
|
+
s.version = "1.5.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "2015-
|
11
|
+
s.date = "2015-05-27"
|
12
12
|
s.description = "All the stuff that isn't good/big enough for a real library."
|
13
13
|
s.email = "flori@ping.de"
|
14
14
|
s.extra_rdoc_files = ["README.md", "lib/dslkit.rb", "lib/dslkit/polite.rb", "lib/dslkit/rude.rb", "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/case_predicate.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/dslkit.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/implement.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/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/thread_local.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/case_predicate.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/dslkit.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/implement.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/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/time_freezer.rb", "lib/tins/xt/to.rb", "lib/tins/xt/uniq_by.rb", "lib/tins/xt/write.rb"]
|
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: 1.5.
|
4
|
+
version: 1.5.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: 2015-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|