Class: FollowersNumber::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/followers_number/parser.rb

Constant Summary collapse

MAPPING =
{
  'twitter.com' => FollowersNumber::Parsers::Twitter,
  'instagram.com' => FollowersNumber::Parsers::Instagram
}

Class Method Summary collapse

Class Method Details

.call(profile_url, response) ⇒ Object



8
9
10
11
12
13
# File 'lib/followers_number/parser.rb', line 8

def self.call(profile_url, response)
  html = ::Nokogiri::HTML(response.body)
  mapper = MAPPING[URI.parse(profile_url).host]

  mapper.parse(html)
end