class FacebookScrapper::Post

Attributes

comment_count[RW]
like_count[RW]
owner[RW]
post_link[RW]
post_owner_link[RW]
text[RW]
time[RW]

Public Class Methods

new() click to toggle source
# File lib/facebook_scrapper/post.rb, line 5
def initialize
  self.owner = ""
  self.text = ""
  self.like_count = 0
  self.comment_count = 0
  self.time = ""
  self.post_owner_link = ""
  self.comment_link = ""
  self.like_link = ""
  self.more_link = ""
  self.post_link = ""
end

Public Instance Methods

to_h() click to toggle source
# File lib/facebook_scrapper/post.rb, line 18
def to_h
  hash = {}
  instance_variables.each do |var|
    hash[var.to_s.delete("@")] = instance_variable_get(var)
  end
  return hash
end
to_json() click to toggle source
# File lib/facebook_scrapper/post.rb, line 26
def to_json
  to_h.to_json
end
to_str() click to toggle source
# File lib/facebook_scrapper/post.rb, line 30
def to_str
  s = "\nPost by #{self.owner}: "
  s += "#{self.text} \n"
  s += "Likes: #{self.like_count.to_s} - "
  s += "Comments: #{self.comment_count.to_s} - "
  s += "#{self.time} "
  s += " - Privacy: #{self.privacy}\n-"
  s += "\n Comment -> #{self.comment_link}\n"
  return s
end