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/templates/default/layout/html/setup.rb
2015-03-29 01:15:40 -06:00

40 lines
945 B
Ruby

def stylesheets
%w(css/solarized.css css/bootstrap.css css/global.css) + super
end
def javascripts
javascripts = super
javascripts.insert 1, 'js/jquery.stickyheaders.js', 'js/underscore.min.js'
end
def diskfile
@file.attributes[:markup] ||= markup_for_file('', @file.filename)
if @file.filename == 'README.md'
contents = preprocess_index(@file.contents)
else
contents = @file.contents
end
data = htmlify(contents, @file.attributes[:markup])
"<div id='filecontents'>" + data + "</div>"
end
def preprocess_index(contents)
regex = /\[ (\w+) \] \( lib \/ ([^()]+) \.rb (?:\#L\d+)? \)/x
contents.gsub(regex) do
method_name, file_path = $1, $2
module_name = file_path.split('/')[0..2].
map do |value|
value.
split('_').
map { |word| word[0].upcase + word[1..-1] }.
join
end.
join('::')
"{#{module_name}##{method_name} #{method_name}}"
end
end