tins 1.4.0 → 1.4.1
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/implement.rb +4 -1
- data/lib/tins/version.rb +1 -1
- data/tests/implement_test.rb +13 -2
- data/tins.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7179c6d716a137637e5911d4acc12b00535fdc2
|
4
|
+
data.tar.gz: 34a2983eaf2d5290a38f789ae66274d79c550a11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ae38a401a666814bb1077e6ddd904dccd9469c0211a3be135a39c92c39b85005d9db0fdf0ee2fec00e10c3bb183074a6b6eee50694de338726b754a3580e7c
|
7
|
+
data.tar.gz: 1f7157f970f167a0f7b2ac0cdeee59498f0c296f0687ae3324b7638746b711e8a016dec018d386f856ede0e4212b97852b11546b096d544d8a835fa62c6747e2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
data/lib/tins/implement.rb
CHANGED
@@ -9,8 +9,11 @@ module Tins
|
|
9
9
|
}
|
10
10
|
|
11
11
|
def implement(method_name, msg = :default)
|
12
|
-
|
12
|
+
case msg
|
13
|
+
when ::Symbol
|
13
14
|
msg = MESSAGES.fetch(msg)
|
15
|
+
when ::Hash
|
16
|
+
return implement method_name, msg.fetch(:in)
|
14
17
|
end
|
15
18
|
begin
|
16
19
|
msg = msg % { method_name: method_name, module: self }
|
data/lib/tins/version.rb
CHANGED
data/tests/implement_test.rb
CHANGED
@@ -8,13 +8,16 @@ module Tins
|
|
8
8
|
class A
|
9
9
|
implement :foo
|
10
10
|
|
11
|
-
implement :bar, :subclass
|
11
|
+
implement :bar, in: :subclass
|
12
12
|
|
13
|
-
implement :baz, :submodule
|
13
|
+
implement :baz, in: :submodule
|
14
14
|
|
15
15
|
implement :qux, 'blub %{method_name} blob %{module}'
|
16
16
|
|
17
17
|
implement :quux, 'blab'
|
18
|
+
|
19
|
+
implement def foobar(x1, x2)
|
20
|
+
end, in: :subclass
|
18
21
|
end
|
19
22
|
|
20
23
|
def test_implement_default
|
@@ -51,6 +54,14 @@ module Tins
|
|
51
54
|
assert_equal('blab', error_message { A.new.quux })
|
52
55
|
end
|
53
56
|
|
57
|
+
def test_implement_def_subclass
|
58
|
+
assert_equal(
|
59
|
+
'method foobar has to be implemented in subclasses of '\
|
60
|
+
'Tins::ImplementTest::A',
|
61
|
+
error_message { A.new.foobar }
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
54
65
|
private
|
55
66
|
|
56
67
|
def error_message
|
data/tins.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: tins 1.4.
|
2
|
+
# stub: tins 1.4.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "tins"
|
6
|
-
s.version = "1.4.
|
6
|
+
s.version = "1.4.1"
|
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"]
|