Class: IdsPlease::Vkontakte

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

Constant Summary collapse

MASK =
/vk\.com|vkontakte/i

Class Method Summary collapse

Methods inherited from BaseParser

to_sym

Class Method Details

.parse(links) ⇒ Object



6
7
8
# File 'lib/ids_please/vkontakte.rb', line 6

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


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

def self.parse_link(link)
  if link.path =~ /id|club/
    id = link.path.sub(/\A\/id|\A\/club/, '')
    id.split(/[\/\?#]/).first
  else
    link.path.split('/')[1]
  end
end