Sha256: 67e3012d0e9f2ec4e47aaece59c7d0062ee6fecdf8eecc1920c002e65665f7a2

Contents?: true

Size: 959 Bytes

Versions: 4

Compression:

Stored size: 959 Bytes

Contents

DuckPuncher.logger = Logger.new(STDOUT).tap do |config|
  config.formatter = proc { |*args| "[DuckPuncher] #{args[0]}: #{args[-1]}\n" }
  config.level = Logger::ERROR
end

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|
        DuckPuncher.logger.debug("Sending include to #{k} with Enumerable") and k.send(:include, Enumerable)
      end
    }
  }],
  [Numeric, DuckPuncher::Ducks::Numeric],
  [Hash, DuckPuncher::Ducks::Hash],
  [Object, DuckPuncher::Ducks::Object],
  [Module, DuckPuncher::Ducks::Module],
  [Method, DuckPuncher::Ducks::Method, { before: ->(_target) { DuckPuncher::GemInstaller.initialize! } }],
]
ducks << ['ActiveRecord::Base', DuckPuncher::Ducks::ActiveRecord] if defined? ::ActiveRecord
ducks.each do |duck|
  DuckPuncher.register *duck
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
duck_puncher-4.3.1 lib/duck_puncher/defaults.rb
duck_puncher-4.3.0 lib/duck_puncher/defaults.rb
duck_puncher-4.2.3 lib/duck_puncher/defaults.rb
duck_puncher-4.2.2 lib/duck_puncher/defaults.rb