Module: SDoc::GitHub

Included in:
RDoc::Generator::SDoc
Defined in:
lib/sdoc/github.rb

Instance Method Summary collapse

Instance Method Details

#github_url(path) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sdoc/github.rb', line 2

def github_url(path)
  return false unless have_git?

  unless @github_url_cache.has_key? path
    @github_url_cache[path] = false
    file = @store.find_file_named(path)
    if file
      base_url = repository_url(path)
      if base_url
        relative_url = path_relative_to_repository(path)
        @github_url_cache[path] = "#{base_url}#{last_commit_sha1}#{relative_url}"
      end
    end
  end
  @github_url_cache[path]
end