You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

17 lines
495 B

class MonkeyPatcher
class << self
MONKEY_PATCHES = Rails.root.join('lib', 'monkey_patches')
def run(&)
patches = Dir.glob(MONKEY_PATCHES.join('**', '*.rb'))
patches.each do |patch|
file = Pathname.new(patch).relative_path_from(MONKEY_PATCHES).to_s
next if file == 'monkey_patcher.rb' # filter off its own file!
if !block_given? || yield(file)
puts "🐵 patching... #{file}"
require file
end
end
end
end
end