Skip to content

Instantly share code, notes, and snippets.

@colindensem
Created June 3, 2021 10:28
Show Gist options
  • Save colindensem/1606c0221affaee23acc5d70fa036b5a to your computer and use it in GitHub Desktop.
Save colindensem/1606c0221affaee23acc5d70fa036b5a to your computer and use it in GitHub Desktop.
Service object callable
module Callable
extend ActiveSupport::Concern
class_methods do
def call(*args)
new(*args).call
end
end
end
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