class JekyllGithubContent::GithubUriParser

Constants

GITHUB_RAW_URI_ROOT
GITHUB_URI_ROOT

Attributes

file[R]
repo[R]
user[R]

Public Class Methods

new(path) click to toggle source
# File lib/jekyll_github_content.rb, line 15
def initialize(path)
  relative_path = path.sub(/^https?\:\/\//, '').sub(/^github.com/, '')
  url_chunks = relative_path.split('/').delete_if { |e| e.empty? }

  @user, @repo, blob, @branch = url_chunks[0..3]
  @file = File.join(url_chunks[4..-1])
end

Public Instance Methods

get_raw_file_uri() click to toggle source
# File lib/jekyll_github_content.rb, line 23
def get_raw_file_uri
  File.join(GITHUB_RAW_URI_ROOT, @user, @repo, @branch, @file)
end
get_repo_uri() click to toggle source
# File lib/jekyll_github_content.rb, line 31
def get_repo_uri
  File.join(GITHUB_URI_ROOT, @user, @repo)
end
get_user_uri() click to toggle source
# File lib/jekyll_github_content.rb, line 27
def get_user_uri
  File.join(GITHUB_URI_ROOT, @user)
end