Create a gist now

Instantly share code, notes, and snippets.

class PublishesPost
def self.call(*args)
new(*args).call
end
attr_reader :post, :user
def initialize(post, user)
@post, @user = post, user
end
def call
post.publish(user)
send_notifications
end
private
def send_notification
# ...
end
end
class PublishesPost
def self.call(post, user)
post.publish(user)
PublicationMailer.deliver(post) # or whatever was inside .send_notifications
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment