invokr 0.9.3 → 0.9.4
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.
- checksums.yaml +4 -4
- data/lib/invokr/builder.rb +3 -3
- data/lib/invokr/dependency_injection.rb +1 -1
- data/lib/invokr/version.rb +1 -1
- data/test/dependency_injection_test.rb +26 -1
- 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: 85451302ca410ddae97b77e6b255882d00f33a19
|
4
|
+
data.tar.gz: e91e12a4e7025a3b7cb3301032dd6cb2223e46d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf52146b18eabed9c93bea408b3d54d4a9c473928f2b47954f57b6e4fbacacac18818cfb87a9559212069a0dad76d44016703b19dafc7e019e53dd66e2620705
|
7
|
+
data.tar.gz: 449775825ff9878ae2b67d745a883b3cd0666c75178d45c4a7171f1c39c5f071cf6df7f3b5923f2fc9340a94d46c361ca4a58d2683c888789ea5ce92b61686e0
|
data/lib/invokr/builder.rb
CHANGED
@@ -31,10 +31,10 @@ module Invokr
|
|
31
31
|
|
32
32
|
def build_invocation
|
33
33
|
@block_arg = @implicit_block if @implicit_block
|
34
|
-
if method.
|
35
|
-
Invocation.new :call, @positional_args, @keyword_args, @block_arg
|
36
|
-
else
|
34
|
+
if method.respond_to? :name
|
37
35
|
Invocation.new method.name, @positional_args, @keyword_args, @block_arg
|
36
|
+
else
|
37
|
+
Invocation.new :call, @positional_args, @keyword_args, @block_arg
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
data/lib/invokr/version.rb
CHANGED
@@ -16,17 +16,32 @@ class DependencyInjectionExampleTest < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_injecting_a_proc
|
19
|
-
my_proc = -> foo do OpenStruct.new foo: foo end
|
19
|
+
my_proc = -> (foo,bar) do OpenStruct.new foo: foo, bar: bar end
|
20
20
|
|
21
21
|
obj = Invokr.inject(
|
22
22
|
my_proc,
|
23
23
|
:using => {
|
24
24
|
:foo => 'bar',
|
25
|
+
:bar => 'baz',
|
25
26
|
:ping => 'pong',
|
26
27
|
}
|
27
28
|
)
|
28
29
|
|
29
30
|
assert_equal 'bar', obj.foo
|
31
|
+
assert_equal 'baz', obj.bar
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_injecting_proc_duck_type
|
35
|
+
obj = Invokr.inject(
|
36
|
+
TestProcDuckType.new,
|
37
|
+
:using => {
|
38
|
+
:foo => 'FOO',
|
39
|
+
:bar => 'BAZ',
|
40
|
+
},
|
41
|
+
)
|
42
|
+
|
43
|
+
assert_equal 'FOO', obj.foo
|
44
|
+
assert_equal 'BAZ', obj.bar
|
30
45
|
end
|
31
46
|
|
32
47
|
class TestObject
|
@@ -37,4 +52,14 @@ class DependencyInjectionExampleTest < Minitest::Test
|
|
37
52
|
@guitarist = guitarist
|
38
53
|
end
|
39
54
|
end
|
55
|
+
|
56
|
+
class TestProcDuckType
|
57
|
+
def parameters
|
58
|
+
[[:req, :foo],[:req, :bar]]
|
59
|
+
end
|
60
|
+
|
61
|
+
def call(foo, bar)
|
62
|
+
OpenStruct.new foo: foo, bar: bar
|
63
|
+
end
|
64
|
+
end
|
40
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invokr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ntl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|