Class: FacebookScrapper::Post
- Inherits:
-
Object
- Object
- FacebookScrapper::Post
- Defined in:
- lib/facebook_scrapper/post.rb
Instance Attribute Summary collapse
-
#comment_count ⇒ Object
Returns the value of attribute comment_count.
-
#comment_link ⇒ Object
Returns the value of attribute comment_link.
-
#like_count ⇒ Object
Returns the value of attribute like_count.
-
#like_link ⇒ Object
Returns the value of attribute like_link.
-
#more_link ⇒ Object
Returns the value of attribute more_link.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#post_link ⇒ Object
Returns the value of attribute post_link.
-
#post_owner_link ⇒ Object
Returns the value of attribute post_owner_link.
-
#text ⇒ Object
Returns the value of attribute text.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize ⇒ Post
constructor
A new instance of Post.
- #to_h ⇒ Object
- #to_json ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize ⇒ Post
Returns a new instance of Post.
5 6 7 8 9 10 11 12 13 14 15 16 |
# 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 |
Instance Attribute Details
#comment_count ⇒ Object
Returns the value of attribute comment_count.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def comment_count @comment_count end |
#comment_link ⇒ Object
Returns the value of attribute comment_link.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def comment_link @comment_link end |
#like_count ⇒ Object
Returns the value of attribute like_count.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def like_count @like_count end |
#like_link ⇒ Object
Returns the value of attribute like_link.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def like_link @like_link end |
#more_link ⇒ Object
Returns the value of attribute more_link.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def more_link @more_link end |
#owner ⇒ Object
Returns the value of attribute owner.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def owner @owner end |
#post_link ⇒ Object
Returns the value of attribute post_link.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def post_link @post_link end |
#post_owner_link ⇒ Object
Returns the value of attribute post_owner_link.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def post_owner_link @post_owner_link end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def text @text end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/facebook_scrapper/post.rb', line 3 def time @time end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 |
# 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 ⇒ Object
26 27 28 |
# File 'lib/facebook_scrapper/post.rb', line 26 def to_json to_h.to_json end |
#to_str ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# 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 |