Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Railsy callback style
class PublishesPosts < Struct.new(:post_id, :ui)
def run
Blog.lookup_post(post_id) do |result|
result.success => lambda {|post| post.publish; ui.post_published(post) },
result.failure => lambda {|post_id| ui.no_such_post(post_id) })
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.