Sha256: 65d22cb2044d7cf625c1f3639d1795e89aad4ccaaa492ae604f100284797d01a

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

module Ghit
  class SshGlobals

    attr_reader :url, :repository, :author

    def initialize remote
      @remote       = remote
      @author       = extract_author
      @repository   = extract_repository
      @url          = extract_url
    end

    private

    def extract_url
      "https://github.com/#{@author}/#{@repository}"
    end

    def extract_author 
      @remote.split[-2].split("/")[0].split(":")[-1]
    end

    def extract_repository
      @remote.scan(/\/(.*).git/).join
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ghit-0.2.4 lib/ghit/ssh_globals.rb
ghit-0.2.3 lib/ghit/ssh_globals.rb
ghit-0.2.2 lib/ghit/ssh_globals.rb
ghit-0.2.1 lib/ghit/ssh_globals.rb
ghit-0.2.0 lib/ghit/ssh_globals.rb