class JekyllGithubContent::GithubContentRenderer

Public Class Methods

new(tag_name, params, tokens) click to toggle source
Calls superclass method
# File lib/jekyll_github_content.rb, line 39
def initialize(tag_name, params, tokens)
  path, @initial_line, @end_line = params.split
  @github_file = GithubUriParser.new(path)
  @initial_line, @end_line = parse_line_boundaries(@initial_line, @end_line)
  super
end

Public Instance Methods

render(context) click to toggle source
# File lib/jekyll_github_content.rb, line 46
def render(context)
  file_lines = cache.fetch(@github_file.get_raw_file_uri) do
    open(@github_file.get_raw_file_uri).readlines
  end
  lines_to_print = file_lines[@initial_line..@end_line]
  lines_to_print.join
end