1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/doc_config/yard/setup.rb
Kapil Sachdev b7e02184d9 fix(rubocop): Fix Layout/LineLength
- bump rubocop to v1.0
- Fix Layout/MultilineAssignmentLayout and other remaining offences
- Exculde appraisal generated gemfiles in rubocop
- Replace NON_NUMERIC_VALUE constant with instance method against 
failing test case in  rails <= 5.1 and postgres adapter.
This is a defect in rails where a frozen string is modified in 
https://github.com/rails/rails/blob/v5.1.7/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb#L25
2020-11-03 10:05:25 -07:00

24 lines
521 B
Ruby

YARD::Templates::Engine.register_template_path(
"#{File.dirname(__FILE__)}/templates",
)
require 'rouge'
module YARD
module Templates
module Helpers
module HtmlSyntaxHighlightHelper
def html_syntax_highlight_ruby(source)
highlight(:ruby, source)
end
private
def highlight(language, source)
lexer = Rouge::Lexers.const_get(language.capitalize)
Rouge::Formatters::HTML.new.format(lexer.new.lex(source))
end
end
end
end
end