Class: AtTheMovies::Parsers::Interview

Inherits:
AtTheMovies::Parser show all
Defined in:
lib/at_the_movies/parsers/interview.rb

Instance Attribute Summary

Attributes inherited from AtTheMovies::Parser

#page

Instance Method Summary collapse

Methods inherited from AtTheMovies::Parser

#initialize, parse

Constructor Details

This class inherits a constructor from AtTheMovies::Parser

Instance Method Details

#dateObject



19
20
21
# File 'lib/at_the_movies/parsers/interview.rb', line 19

def date
  Date.parse(@page.search('meta[@name="Date"]').first['content'].gsub('/', '-'))
end

#detailsObject



11
12
13
# File 'lib/at_the_movies/parsers/interview.rb', line 11

def details
  @page.body.scan(/(Margaret|David) interviews (.*).<\/p>\r/).flatten
end

#parseObject



4
5
6
7
8
9
# File 'lib/at_the_movies/parsers/interview.rb', line 4

def parse
  interviewer, interviewee = details
  if interviewer && interviewee
    AtTheMovies::Interview.new(title, date, interviewee, interviewer, @page.uri.to_s)
  end
end

#titleObject



15
16
17
# File 'lib/at_the_movies/parsers/interview.rb', line 15

def title
  @page.title.strip[15..-1]
end