class JekyllGithubSample::FileHelper

Constants

GITHUB_RAW_URI
GITHUB_URI
WEB_URI_PART

Attributes

filename[R]
project_name[R]
user[R]

Public Class Methods

new(path) click to toggle source
# File lib/jekyll_github_sample/file_helper.rb, line 10
def initialize(path)
  @path = path
  parts = @path.split('/').delete_if { |e| e.empty? }
  if parts.include? WEB_URI_PART
    @user, @project_name, @blob, @commitish_or_branch = parts[0..3]
    @filename = File.join(parts[4..-1])
  else
    @user, @project_name, @commitish_or_branch = parts[0..2]
    @filename = File.join(parts[3..-1])
  end
end

Public Instance Methods

raw_uri() click to toggle source
# File lib/jekyll_github_sample/file_helper.rb, line 30
def raw_uri
  File.join(GITHUB_RAW_URI, @user, @project_name, @commitish_or_branch, @filename)
end
user_uri() click to toggle source
# File lib/jekyll_github_sample/file_helper.rb, line 22
def user_uri
  File.join(GITHUB_URI, @user)
end
web_uri() click to toggle source
# File lib/jekyll_github_sample/file_helper.rb, line 26
def web_uri
  File.join(GITHUB_URI, @user, @project_name, WEB_URI_PART, @commitish_or_branch, @filename)
end