Skip to content

Instantly share code, notes, and snippets.

@iain
Created May 2, 2012 21:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iain/2580717 to your computer and use it in GitHub Desktop.
Save iain/2580717 to your computer and use it in GitHub Desktop.
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