class TellyReviews::Review

Attributes

author[RW]
author_twitter[RW]
body[RW]
date[RW]
title[RW]
url[RW]

Public Class Methods

all() click to toggle source
# File lib/telly_reviews/review.rb, line 13
def self.all
  @@all    
end
find(index) click to toggle source
# File lib/telly_reviews/review.rb, line 25
def self.find(index)
  self.all[index-1]
end
new(hash={}) click to toggle source
# File lib/telly_reviews/review.rb, line 6
def initialize(hash={})
  hash.each do |k,v|
    self.send("#{k}=", v)
  end
  @@all << self
end

Public Instance Methods

review_details() click to toggle source
# File lib/telly_reviews/review.rb, line 17
def review_details
  doc = Nokogiri::HTML(open(self.url))

  @date = doc.css(".article-body .abstract .timestamp").text
  @author_twitter = doc.css(".byline .author .url a").text
  @body = doc.css(".article-body .variety-content-wrapper").text.strip
end