Skip to content

Instantly share code, notes, and snippets.

@HeroicEric
Created February 8, 2012 01:11
Show Gist options
  • Save HeroicEric/1763972 to your computer and use it in GitHub Desktop.
Save HeroicEric/1763972 to your computer and use it in GitHub Desktop.
class Blog
attr_reader :entries
attr_writer :post_maker
def initialize
@entries = []
end
def title
"Underwater Basketweaving"
end
def subtitle
"The best way to spend your time, all the time"
end
def new_post
post_maker.call.tap do |p|
p.blog = self
end
end
private
def post_maker
@post_maker ||= Post.public_method(:new)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment