How can I rename a Ruby library module's namespace? -
i'd use ruby stripe library in rails app. uses module stripe
namespace.
i want use stripe
namespace activerecord models, , rename library module stripeapi, e.g. stripeapi::charge
refers stripe library, stripe::charge
refers stripe
-namespaced activerecord model (so e.g. stripe::charge.create(...)
creates database record, rather making api calls).
is there way this?
(sure, rename namespace, or try use differently named models, find kinda ugly.)
i recommend rename own namespace since have full control on code. otherwise become pain in ass if want update version of stripe gem or search bug relating namespace original stripe namespace.
it's lot easier change own namespace instead of changing existing gem (eventually every version again).
Comments
Post a Comment