module Jekyll::Algolia::Utils

def self.monkey_patch(instance, method, block)

https://stackoverflow.com/questions/803020/redefining-a-single-ruby-method-on-a-single-instance-with-a-lambda/16631789
Solution found on

block - The new block to use for replacing (as a proc)
method - The method symbol to overwrite
instance - The instance to overwrite

Public: Allow redefining an instance method on the fly with a new one
def self.monkey_patch(instance, method, block)
  metaclass = class << instance; self; end
  metaclass.send(:define_method, method, block)
end