invokr 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c973b1faf440edfe2f271633ac8e036aa3c5a088
4
- data.tar.gz: 1340286f0aac16980c4fb7946e7c94d5a81ff885
5
- SHA512:
6
- metadata.gz: 277e09fa4dce4c7a8b465b2c9fa02bff91dc4a79f2ea7ea87660fcbce02f251208106053354aa47d93872e40378b39e16717535094983843cf9a31902ad65a39
7
- data.tar.gz: 238f90dc85020e397ea467f167aa0284a809eafabc075a92346e953565b7394d502eb06aa91b15a7379e4c8b5796916f0a507d6993b55a337d911f0f6f9cb37b
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0fa124590c6261ef57809204b483430add793b21
4
+ data.tar.gz: a953afa162953d33320a5ff949441bf48b592377
5
+ SHA512:
6
+ metadata.gz: d1482d8dd40b51917f6595990ab5587272bdd84117141c7dcade7d47e6cea7ce581bbce25fb563403441f17eb0cf36dbe39ca53b5b5e1659da58413400a51a46
7
+ data.tar.gz: 220313488d2ff9a0ef7735ee1ba7d4fd79af1d65214a183983214c9057b09f8f6df64d42989e7a25383edae1c0e52fd643874eca95757d8092b4d97a6275d05c
@@ -4,7 +4,7 @@ module Invokr
4
4
 
5
5
  def inject obj, using
6
6
  meth = case obj
7
- when lambda { |obj| obj.respond_to?(:call) } then :inject_proc
7
+ when lambda { |obj| proc? obj } then :inject_proc
8
8
  when Class then :inject_klass
9
9
  else raise ArgumentError, "can't inject #{obj.inspect}"
10
10
  end
@@ -32,6 +32,10 @@ module Invokr
32
32
  injector.inject
33
33
  end
34
34
 
35
+ def proc? object
36
+ object.respond_to? :call and object.respond_to? :to_proc
37
+ end
38
+
35
39
  Injector = Struct.new :resolver, :obj do
36
40
  def keys
37
41
  method.parameters.map { |_, identifier| identifier }
@@ -1,3 +1,3 @@
1
1
  module Invokr
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -61,5 +61,9 @@ class DependencyInjectionExampleTest < Minitest::Test
61
61
  def call foo, bar
62
62
  OpenStruct.new foo: foo, bar: bar
63
63
  end
64
+
65
+ def to_proc
66
+ method :call
67
+ end
64
68
  end
65
69
  end
metadata CHANGED
@@ -1,64 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: invokr
3
- version: !ruby/object:Gem::Version
4
- version: 0.9.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.7
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - ntl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2014-12-03 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- requirement: &id001 !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: "1.6"
11
+ date: 2015-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
20
14
  name: bundler
21
- prerelease: false
22
- version_requirements: *id001
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
23
20
  type: :development
24
- - !ruby/object:Gem::Dependency
25
- requirement: &id002 !ruby/object:Gem::Requirement
26
- requirements:
27
- - &id003
28
- - ">="
29
- - !ruby/object:Gem::Version
30
- version: "0"
31
- name: minitest
32
21
  prerelease: false
33
- version_requirements: *id002
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
34
  type: :development
35
- - !ruby/object:Gem::Dependency
36
- requirement: &id004 !ruby/object:Gem::Requirement
37
- requirements:
38
- - *id003
39
- name: minitest-red_green
40
35
  prerelease: false
41
- version_requirements: *id004
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest-red_green
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
42
48
  type: :development
43
- - !ruby/object:Gem::Dependency
44
- requirement: &id005 !ruby/object:Gem::Requirement
45
- requirements:
46
- - *id003
47
- name: rake
48
49
  prerelease: false
49
- version_requirements: *id005
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
50
62
  type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
51
69
  description: Invoke methods with a consistent Hash interface. Useful for metaprogramming.
52
- email:
70
+ email:
53
71
  - nathanladd+github@gmail.com
54
72
  executables: []
55
-
56
73
  extensions: []
57
-
58
74
  extra_rdoc_files: []
59
-
60
- files:
61
- - .gitignore
75
+ files:
76
+ - ".gitignore"
62
77
  - Gemfile
63
78
  - LICENSE.txt
64
79
  - README.md
@@ -83,29 +98,30 @@ files:
83
98
  - test/rest_args_test.rb
84
99
  - test/test_helper.rb
85
100
  homepage: https://github.com/ntl/invokr
86
- licenses:
101
+ licenses:
87
102
  - MIT
88
103
  metadata: {}
89
-
90
104
  post_install_message:
91
105
  rdoc_options: []
92
-
93
- require_paths:
106
+ require_paths:
94
107
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
96
- requirements:
97
- - *id003
98
- required_rubygems_version: !ruby/object:Gem::Requirement
99
- requirements:
100
- - *id003
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
101
118
  requirements: []
102
-
103
119
  rubyforge_project:
104
- rubygems_version: 2.4.2
120
+ rubygems_version: 2.4.5
105
121
  signing_key:
106
122
  specification_version: 4
107
123
  summary: Invoke methods with a consistent Hash interface.
108
- test_files:
124
+ test_files:
109
125
  - test/block_args_test.rb
110
126
  - test/dependency_injection_test.rb
111
127
  - test/invokr_test.rb