duck_puncher 4.3.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/duck_puncher.gemspec +1 -1
- data/lib/duck_puncher/defaults.rb +6 -3
- data/lib/duck_puncher/duck.rb +3 -2
- data/lib/duck_puncher/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b2bedc79e336e70d3b4fb60c14b2d80e21928cc
|
4
|
+
data.tar.gz: 378563cdbd57904e2ee40d04d03dfc61aa46ccea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c546b1afdb926ac913ce522ffd1215540cbc92bc09a48c7dd26a4d832d3a0faaebdf533ab6c12a72e25013b4fd1e9a39e1f842cec95cdbd8b3349d9d8e04360
|
7
|
+
data.tar.gz: b00c933d0ac6cc512a1b60a26e8d59c5e030f6aab143c65b35e37eb4a16ed28de58ea273a4525f6e371de72047add75b21dea5ed59c762408bbfa153f5b35d5c
|
data/CHANGELOG.md
CHANGED
data/duck_puncher.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = ">= 2.0.0"
|
22
22
|
|
23
|
-
spec.add_runtime_dependency "usable", ">=
|
23
|
+
spec.add_runtime_dependency "usable", ">= 3.3"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake", '~> 10.1'
|
@@ -3,12 +3,15 @@ DuckPuncher.logger = Logger.new(STDOUT).tap do |config|
|
|
3
3
|
config.level = Logger::ERROR
|
4
4
|
end
|
5
5
|
|
6
|
+
# [Target, Extensions]
|
6
7
|
ducks = [
|
7
8
|
[String, DuckPuncher::Ducks::String],
|
8
9
|
[Enumerable, DuckPuncher::Ducks::Enumerable, {
|
9
|
-
|
10
|
-
|
11
|
-
[Array, Set, Range, Enumerator]
|
10
|
+
after: proc { |target|
|
11
|
+
# Re-include Enumerable in these classes to pick up the new extensions
|
12
|
+
hosts = [Array, Set, Range, Enumerator]
|
13
|
+
hosts = [target] if hosts.include?(target)
|
14
|
+
hosts.each do |k|
|
12
15
|
DuckPuncher.logger.debug("Sending include to #{k} with Enumerable") and k.send(:include, Enumerable)
|
13
16
|
end
|
14
17
|
}
|
data/lib/duck_puncher/duck.rb
CHANGED
@@ -25,8 +25,9 @@ module DuckPuncher
|
|
25
25
|
options[:before].call(target) if options[:before]
|
26
26
|
punches = Array(opts[:only] || Ducks::Module.instance_method(:local_methods).bind(mod).call)
|
27
27
|
DuckPuncher.logger.info %Q(#{target}#{" <-- #{mod.name}#{punches}" if punches.any?})
|
28
|
-
|
29
|
-
|
28
|
+
extender = Usable::ModExtender.new(mod, only: options.delete(:only), method: options.delete(:method))
|
29
|
+
extender.call target
|
30
|
+
extender = nil
|
30
31
|
options[:after].call(target) if options[:after]
|
31
32
|
end
|
32
33
|
targets
|
data/lib/duck_puncher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duck_puncher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: usable
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|