Sha256: 5570006d2402f460af3a0fdf68aa4f9346e3f26649a8edb2490b27692c124d60

Contents?: true

Size: 391 Bytes

Versions: 7

Compression:

Stored size: 391 Bytes

Contents

class IdsPlease
  class Vkontakte < IdsPlease::BaseParser

    MASK = /vk\.com|vkontakte/i

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

    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

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ids_please-1.0.6 lib/ids_please/vkontakte.rb
ids_please-1.0.5 lib/ids_please/vkontakte.rb
ids_please-1.0.4 lib/ids_please/vkontakte.rb
ids_please-1.0.3 lib/ids_please/vkontakte.rb
ids_please-1.0.2 lib/ids_please/vkontakte.rb
ids_please-1.0.1 lib/ids_please/vkontakte.rb
ids_please-1.0.0 lib/ids_please/vkontakte.rb