class RedditArchiver::Comment

Attributes

body[R]
score[R]
subreddit[R]

Public Class Methods

new(comment) click to toggle source
Calls superclass method
# File lib/reddit_archiver/comment.rb, line 5
def initialize(comment)
  @body = comment["body"]
  @score = comment["ups"] - comment["downs"]
  @link_title = comment["link_title"]
  @link_id = comment["link_id"]
  @link_author = comment["link_author"]
  super
end

Public Instance Methods

file_contents() click to toggle source
# File lib/reddit_archiver/comment.rb, line 26
    def file_contents
      <<-EOF.gsub(/^ {8}/, '')
        Date: #{created}
        On Post: #{link_title} by #{link_author}
        Subreddit: /r/#{subreddit}
        Link: #{submission_link}
        Score: #{score}

        #{body}
      EOF
    end
submission_title() click to toggle source
# File lib/reddit_archiver/comment.rb, line 22
def submission_title
  link_title.parameterize[0..96]
end
title() click to toggle source
# File lib/reddit_archiver/comment.rb, line 18
def title
  "#{submission_title}-#{reddit_id}"
end