Module: SDoc::GitHub

Included in:
RDoc::Generator::SHtml
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
18
# File 'lib/sdoc/github.rb', line 2

def github_url(path)
  unless @github_url_cache.has_key? path
    @github_url_cache[path] = false
    file = RDoc::TopLevel.find_file_named(path)
    if file
      base_url = repository_url(path)
      if base_url
        sha1 = commit_sha1(path)
        if sha1
          relative_url = path_relative_to_repository(path)
          @github_url_cache[path] = "#{base_url}#{sha1}#{relative_url}"
        end
      end
    end
  end
  @github_url_cache[path]
end