Class: PostScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/craigslister/post_scraper.rb

Overview

Creates Post objects out of an HTML page

Instance Method Summary collapse

Constructor Details

#initialize(page, link) ⇒ PostScraper

Returns a new instance of PostScraper.



3
4
5
6
# File 'lib/craigslister/post_scraper.rb', line 3

def initialize(page, link)
  @page = page
  @link = link
end

Instance Method Details

#new_postObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/craigslister/post_scraper.rb', line 8

def new_post
  Post.new(
    image: image,
    title: title,
    price: price,
    location: location,
    description: description,
    url: link
  )
end