Sha256: 136b478068f35355300022bc995a9cd997993bc369ecd0ae376e9f10b5d80d8b

Contents?: true

Size: 385 Bytes

Versions: 3

Compression:

Stored size: 385 Bytes

Contents

module Ghit
  class HttpRemoteUrlBuilder
    def initialize remote, page = nil
      @remote = remote
      @page   = page
    end

    def build
      "https://github.com/#{author}/#{name}/#{@page}"
    end

    private

    def repo_url
      @remote.split[1]
    end

    def author
      repo_url.split('/')[-2]
    end

    def name
      repo_url.split('/')[-1]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ghit-0.1.0 lib/ghit/http_remote_url_builder.rb
ghit-0.0.2 lib/ghit/http_remote_url_builder.rb
ghit-0.0.1 lib/ghit/http_remote_url_builder.rb