Method: Audits1984::ApplicationHelper#highlight_code

Defined in:
app/helpers/audits1984/application_helper.rb

#highlight_code(source) ⇒ Object



28
29
30
31
32
# File 'app/helpers/audits1984/application_helper.rb', line 28

def highlight_code(source)
  formatter = Rouge::Formatters::HTMLLinewise.new(Rouge::Formatters::HTML.new)
  lexer = Rouge::Lexers::Ruby.new
  formatter.format(lexer.lex(source)).html_safe
end