Class: IdsPlease::GooglePlus

Inherits:
BaseParser show all
Defined in:
lib/ids_please/google_plus.rb

Constant Summary collapse

MASK =
/google/i

Class Method Summary collapse

Methods inherited from BaseParser

network_name

Class Method Details

.parse(links) ⇒ Object



5
6
7
# File 'lib/ids_please/google_plus.rb', line 5

def self.parse(links)
  links.map { |l| parse_link(l) }.compact
end


9
10
11
12
13
14
15
16
# File 'lib/ids_please/google_plus.rb', line 9

def self.parse_link(link)
  if link.host == 'google.com'
    link.path.split('/')[1]
  else
    matched = link.path.match(/\/(\d{2,})/)
    matched[1] if matched
  end
end