require "rouge" require "rails_rinku" module Audits1984 module ApplicationHelper def format_date(date) # date.strftime("%Y-%m-%d") end def format_date_and_time(date) # date.strftime("%Y-%m-%d at %I:%m %P") end def highlighted_code_from(commands) highlight_code commands.collect(&:statements).collect(&:strip).filter(&:present?).join("\n") end 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 def sensitive_session_decoration(session) "*" if session.sensitive? end end end