Method: JekyllGithubSample::FileHelper#initialize

Defined in:
lib/jekyll_github_sample/file_helper.rb

#initialize(path) ⇒ FileHelper

Returns a new instance of FileHelper.



10
11
12
13
14
15
16
17
18
19
20
# 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