Sha256: 7dab34e28f9f62e2c90481b046cc47621d0e6367fc1b21bbbdbc970418121df2
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require "rouge" module Audits1984 module ApplicationHelper include Audits1984::Engine.routes.url_helpers def auditor_name_for(auditor) if auditor == Audits1984::Current.auditor "You" else auditor.public_send(Audits1984.auditor_name_attribute) end end def format_date(date) # <time datetime="2016-1-1">11:09 PM - 1 Jan 2016</time> date.strftime("%Y-%m-%d") end def format_date_and_time(date) # <time datetime="2016-1-1">11:09 PM - 1 Jan 2016</time> 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
audits1984-0.1.7 | app/helpers/audits1984/application_helper.rb |
audits1984-0.1.6 | app/helpers/audits1984/application_helper.rb |