class Brah::Brah

Attributes

command[R]

Public Class Methods

new(git_remote_output) click to toggle source
# File lib/brah.rb, line 10
def initialize(git_remote_output)
  raise("No remotes found!") if git_remote_output.empty?
  parsed_command = convert_ssh_to_http(git_remote_output)
  @command = "open #{parsed_command}"
end

Public Instance Methods

run() click to toggle source
# File lib/brah.rb, line 16
def run
  system(command)
end

Private Instance Methods

convert_ssh_to_http(git_remote_output) click to toggle source
# File lib/brah.rb, line 22
def convert_ssh_to_http(git_remote_output)
  git_remote_output.match(/origin\t(\S+)/)[1].
    gsub(/\.git$/, "").
    gsub("com:", "com/").
    gsub("git@", "https://")
end