Class: SourceBrowser::SourceController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SourceBrowser::SourceController
- Defined in:
- app/controllers/source_browser/source_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 |
# File 'app/controllers/source_browser/source_controller.rb', line 5 def index @files = git.ls_files end |
#show ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/source_browser/source_controller.rb', line 9 def show @path = params[:id] @object = git.object(@path) @files = git.ls_files @formatter = Rouge::Formatters::HTML.new @formatter = Rouge::Formatters::HTMLLineTable.new(@formatter, line_id: "L%i", line_format: "<a href='?line=%i'>%i</a>") @lexer = Rouge::Lexer.guess(filename: @path, source: @object.contents) @source = @formatter.format(@lexer.lex(@object.contents)) end |