vendredi 19 février 2021

Monkeypatching a ruby gem in ruby on rails

I am attempting to add changes to an existing method from a ruby gem that is defined as follows:

# lib/uppy/s3_multipart/client.rb
...

def this_method
  ...
end

I have installed the gem using bundler and then created a new file as follows:

# app/lib/s3_multipart.rb
require "uppy/s3_multipart"

class Uppy::S3Multipart::Client
  def this_method
    ...
    puts "Using monkeypatched method"
  end
end

My alternative method isn't being used, what am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire