class Strigil::Comment

Attributes

author[R]
subreddit[R]
text[R]
timestamp[R]

Public Class Methods

new(params={}) click to toggle source
# File lib/strigil/comment.rb, line 6
def initialize(params={})
  @author = params[:author]
  @subreddit = params[:subreddit]
  @permalink = params[:permalink]
  @timestamp = Time.parse(params[:timestamp])
  @text = params[:text]
end

Public Instance Methods

display() click to toggle source
# File lib/strigil/comment.rb, line 24
def display
  %{
    posted by #{author} on /r/#{subreddit}
    #{timestamp} | #{permalink}
    -------------------------------------
    #{text}
  }
end
to_json() click to toggle source
# File lib/strigil/comment.rb, line 14
def to_json
  {
    author: author,
    subreddit: subreddit,
    permalink: permalink,
    timestamp: timestamp,
    text: text
  }.to_json
end