Class: Anchorman::Repo

Inherits:
Struct
  • Object
show all
Defined in:
lib/anchorman/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#git_repoObject

Returns the value of attribute git_repo

Returns:

  • (Object)

    the current value of git_repo



2
3
4
# File 'lib/anchorman/repo.rb', line 2

def git_repo
  @git_repo
end

Instance Method Details

#commit_url(sha) ⇒ Object



15
16
17
18
19
# File 'lib/anchorman/repo.rb', line 15

def commit_url(sha)
  return sha unless is_github?

  "[#{sha}](#{github_url_for 'commit', sha})"
end

#is_github?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/anchorman/repo.rb', line 8

def is_github?
  remote &&
      remote.name == "origin" &&
      remote.url &&
      remote.url.match(/github\.com/)
end

#remoteObject



4
5
6
# File 'lib/anchorman/repo.rb', line 4

def remote
  git_repo.remote
end