Sha256: 001f960b5786f3af30497c159a20db61bd772caca2b9ca53b0b0e913ade520a6

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

module Fappu
  class Comment
    attr_accessor :id, :attached_id, :poster, :poster_url, :reputation,
      :text, :date

    def initialize args
      comment_args = comment_parameters(args)
      comment_args.each do |k,v|
        instance_variable_set("@#{k}",v) unless v.nil?
      end
    end

    private

    def comment_parameters(comment)
      params = {
        title: comment["comment_id"],
        attached_id: comment["comment_attached_id"],
        poster: comment["comment_poster"],
        poster_url: comment["comment_poster_url"],
        reputation: comment["comment_reputation"],
        body: comment["comment_text"],
        date: comment["comment_date"]
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fappu-1.0.0 lib/fappu/comment.rb