Class: DevTo::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_to/scraper.rb

Instance Method Summary collapse

Instance Method Details

#get_pageObject



3
4
5
# File 'lib/dev_to/scraper.rb', line 3

def get_page
  Nokogiri::HTML(open("https://dev.to/"))
end

#make_content(current_post) ⇒ Object



13
14
15
16
# File 'lib/dev_to/scraper.rb', line 13

def make_content(current_post)
  post_page = Nokogiri::HTML(open("#{current_post.url}"))
  current_post.add_post_attributes(scrape_content(post_page))
end

#make_postsObject



7
8
9
10
11
# File 'lib/dev_to/scraper.rb', line 7

def make_posts
  posts.each do |post|
    DevTo::Post.new(scrape_posts(post))
  end
end