Sha256: f4e6e20501cafb6a7a33ccadb17ea87dc1980718c357b9b0dc0b8fb04e4cf45b

Contents?: true

Size: 407 Bytes

Versions: 4

Compression:

Stored size: 407 Bytes

Contents

class IdsPlease
  class Facebook < IdsPlease::BaseParser

    MASK = /fb\.me|fb\.com|facebook/i

    def self.parse_link(link)
      query = CGI.parse(link.query) if link.query && !link.query.empty?

      if query && !query['id'].empty?
        query['id'].first
      elsif link.path =~ /\/pages\//
        link.path.split('/').last
      else
        link.path.split('/')[1]
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ids_please-1.0.6 lib/ids_please/facebook.rb
ids_please-1.0.5 lib/ids_please/facebook.rb
ids_please-1.0.4 lib/ids_please/facebook.rb
ids_please-1.0.3 lib/ids_please/facebook.rb