Sha256: 90f4f4643128d69dd4932bedfbde2eb2f1c18617a322b9c6ad466e3f2f4702c8

Contents?: true

Size: 599 Bytes

Versions: 10

Compression:

Stored size: 599 Bytes

Contents

require 'social_parser/provider/base'

module SocialParser
  module Provider
    class Github < Base
      URL_FORMATS = {
        full: /((https?)?:\/\/)?(www\.)?github\.com\/(?<id>[\w\-\.]+)?/i
        # regular: /\Ahttps?:\/\/github\.com\/(?<id>.+?)\/?\Z/
      }

      def provider
        :github
      end

      def url
        "https://github.#{domain}/#{username}"
      end

      private

      def parse_from_url
        URL_FORMATS.values.each do |format|
          m = format.match(url_from_attributes)
          return m[:id] if m
        end
        nil
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
social_parser-1.1.0 lib/social_parser/provider/github.rb
social_parser-1.0.8 lib/social_parser/provider/github.rb
social_parser-1.0.7 lib/social_parser/provider/github.rb
social_parser-1.0.6 lib/social_parser/provider/github.rb
social_parser-1.0.5 lib/social_parser/provider/github.rb
social_parser-1.0.4 lib/social_parser/provider/github.rb
social_parser-1.0.3 lib/social_parser/provider/github.rb
social_parser-1.0.2 lib/social_parser/provider/github.rb
social_parser-1.0.1 lib/social_parser/provider/github.rb
social_parser-1.0.0 lib/social_parser/provider/github.rb