Class: WebPageParser::IndependentPageParserFactory

Inherits:
ParserFactory
  • Object
show all
Defined in:
lib/web-page-parser/parsers/independent_page_parser.rb

Constant Summary collapse

URL_RE =
ORegexp.new("www.independent.co.uk/news/.*[0-9]+.html")
INVALID_URL_RE =
ORegexp.new("www.independent.co.uk/news/pictures")

Class Method Summary collapse

Methods inherited from ParserFactory

add_factory, #can_parse?, #create, factories, inherited, load, parser_for

Class Method Details

.can_parse?(options) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/web-page-parser/parsers/independent_page_parser.rb', line 5

def self.can_parse?(options)
  return nil if INVALID_URL_RE.match(options[:url])
  URL_RE.match(options[:url])
end

.create(options = {}) ⇒ Object



10
11
12
# File 'lib/web-page-parser/parsers/independent_page_parser.rb', line 10

def self.create(options = {})
  IndependentPageParserV1.new(options)
end