Class: JekyllGithubContent::GithubContentRenderer
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- JekyllGithubContent::GithubContentRenderer
show all
- Defined in:
- lib/jekyll_github_content.rb
Instance Method Summary
collapse
Constructor Details
39
40
41
42
43
44
|
# 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
|
Instance Method Details
#render(context) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/jekyll_github_content.rb', line 46
def render(context)
file_lines = cache.fetch(@github_file.get_raw_file_uri) do
URI.open(@github_file.get_raw_file_uri).readlines
end
lines_to_print = file_lines[@initial_line..@end_line]
lines_to_print.join
end
|