Created
June 3, 2021 10:28
-
-
Save colindensem/1606c0221affaee23acc5d70fa036b5a to your computer and use it in GitHub Desktop.
Service object callable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Callable | |
extend ActiveSupport::Concern | |
class_methods do | |
def call(*args) | |
new(*args).call | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServicePoro | |
include Callable | |
attr_reader :arg1, :arg2 | |
def initialize(arg1, arg2) | |
self.arg1 = arg1 | |
self.arg2 = arg2 | |
end | |
def call | |
# Actions | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment