Sha256: 10cf20b9bf2ddc10d30ac261bdd4a22bdefb2daad92d5105ebd2c5b8e2b02df4
Contents?: true
Size: 472 Bytes
Versions: 24
Compression:
Stored size: 472 Bytes
Contents
class RubyPostWithComments class RubyComment attr_accessor :title, :email, :post_id def initialize(attributes = {}) (attributes || {}).each { |name, value| send("#{name}=", value) } end end attr_reader :comments def initialize(comments = {}) @comments = comments.map { |comment| RubyComment.new(comment) } @comments = [] if @comments.nil? end def first_two_comments [ comments[0], comments[1] ] end end
Version data entries
24 entries across 24 versions & 2 rubygems