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

Version Path
rest_my_case-1.10.6 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.10.5 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.10.4 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.10.3 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.10.2 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.10.1 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.9.4 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.9.3 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.9.2 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.9.1 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.9.0 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.8.0 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.7.7 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.7.6 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.7.5 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.7.4 spec/support/validator/models/ruby_post_with_comments.rb
rest_my_case-1.7.0 spec/support/validator/models/ruby_post_with_comments.rb
usecasing_validations-0.7.0 spec/support/models/ruby_post_with_comments.rb
usecasing_validations-0.6.0 spec/support/models/ruby_post_with_comments.rb
usecasing_validations-0.5.5 spec/support/models/ruby_post_with_comments.rb