Sha256: 8a892260f98bade2905b7a2ae055c17e39e4cf2ff82f5a15a5b74852de0c4425
Contents?: true
Size: 665 Bytes
Versions: 33
Compression:
Stored size: 665 Bytes
Contents
class BlogPost attr_accessor :id attr_accessor :title attr_accessor :body attr_accessor :published_at attr_accessor :author def initialize(options = {}) self.id = options[:id] || 1 self.title = options[:title] || 'A Blog Post' self.body = options[:body] || 'Some body content' self.published_at = options[:published_at] || Time.utc(2011,12,30,10,25) self.author = Author.new(options[:author] || {}) end # needed for field= to work def [](idx) send(idx) end def url "/blog_posts/#{id}" end def name title end end class SpecialBlogPost < BlogPost def url "/special_blog_posts/#{id}" end end
Version data entries
33 entries across 33 versions & 1 rubygems