Inhibit method redefined warning if user redefined input method in service object.
zw963 opened this issue · comments
Following is a example:
class InhibitMethodRedefinedWarning < Actor
input :page, default: 1, type: [Integer, String]
def call
result.page = page
end
private
def page
result.page.to_i
end
end
when i run test, get many warn message like this:
/home/zw963/Stocks/marketbet_crawler/app/services/retrieve_insider_history.rb:97: warning: method redefined; discarding old days
/home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/service_actor-3.1.2/lib/service_actor/attributable.rb:26: warning: previous definition of days was here
If this gem expect user override input same name method this way, it should do some hack for avoid produce those warning.
the offical recommand way for this is to add a alias. as following code, (i copy from sequel gem).
you can check discuss here.
https://groups.google.com/g/sequel-talk/c/fwa1Pwye_CY/m/DANKiBGOBQAJ
And this hack should fix many warnings when run rspec --warning
for gem spec.