Reputation: 5552
I've inherited an app that uses a lot of Service Objects, which inherit from ApplicationService
:
class ApplicationService
class InternalServiceError < StandardError; end
include ActiveModel::Model
def self.execute(*args)
new(*args).execute
end
def self.call(...)
new(...).call
end
end
Why would there be both an execute
and a call
method? It seems odd to have both since they are both instantiating an instance of the class.
Also, what is (...)
for? I've not seen that argument style before. How is it different to (*args)
or (**args)
?
Upvotes: 0
Views: 780