lib/duck_puncher/defaults.rb in duck_puncher-4.3.1 vs lib/duck_puncher/defaults.rb in duck_puncher-4.4.0
- old
+ new
@@ -1,15 +1,18 @@
DuckPuncher.logger = Logger.new(STDOUT).tap do |config|
config.formatter = proc { |*args| "[DuckPuncher] #{args[0]}: #{args[-1]}\n" }
config.level = Logger::ERROR
end
+# [Target, Extensions]
ducks = [
[String, DuckPuncher::Ducks::String],
[Enumerable, DuckPuncher::Ducks::Enumerable, {
- # Re-include Enumerable in these classes to pick up the new extensions
- after: proc {
- [Array, Set, Range, Enumerator].each do |k|
+ after: proc { |target|
+ # Re-include Enumerable in these classes to pick up the new extensions
+ hosts = [Array, Set, Range, Enumerator]
+ hosts = [target] if hosts.include?(target)
+ hosts.each do |k|
DuckPuncher.logger.debug("Sending include to #{k} with Enumerable") and k.send(:include, Enumerable)
end
}
}],
[Numeric, DuckPuncher::Ducks::Numeric],