Sha256: 1fd46487b5a3a3c92028ddc9d1cfe068fdd58f14b91df06846d12e43f106d316

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

module Ghit
  class RepoLocator

    class << self
      def open page = nil
        new(page).open
      end
    end

    def initialize(page = nil)
      @page    = page
      @globals = Ghit::Globals.new
    end

    def open
      if RUBY_PLATFORM =~ /darwin/i
        open_for_osx
      elsif RUBY_PLATFORM =~ /linux/i
        open_for_linux
      end
    end

    private

    def open_for_linux
      %x(xdg-open #{build_url})
    end

    def open_for_osx
      %x(open #{build_url})
    end

    def build_url
      "#{@globals.url}/#{@page}"
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ghit-0.2.4 lib/ghit/repo_locator.rb
ghit-0.2.3 lib/ghit/repo_locator.rb
ghit-0.2.2 lib/ghit/repo_locator.rb