Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bswinnerton
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bswinnerton/10411717 to your computer and use it in GitHub Desktop.
Save bswinnerton/10411717 to your computer and use it in GitHub Desktop.
class Post
attr_accessor :title, :body
@@all = []
def initialize(title, body)
@title = title
@body = body
@@all << self
end
def self.all
@@all
end
def to_s
"Title: #{@title}, Body: #{@body}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment