module RubyCritic::ViewHelpers
def asset_path(file)
def asset_path(file) relative_path("assets/#{file}") end
def code_index_path(root_directory, file_name)
def code_index_path(root_directory, file_name) root_directory_path = File.expand_path(root_directory) index_path = "#{root_directory_path}/#{file_name}" index_path = "#{root_directory_path}/overview.html" unless File.exist?(index_path) file_path(index_path) end
def file_directory
def file_directory raise NotImplementedError, "The #{self.class} class must implement the #{__method__} method." end
def file_path(file)
def file_path(file) relative_path(file) end
def relative_path(file)
def relative_path(file) (root_directory + file).relative_path_from(file_directory) end
def root_directory
def root_directory raise NotImplementedError, "The #{self.class} class must implement the #{__method__} method." end
def smell_location_path(location)
def smell_location_path(location) smell_location = "#{location.pathname.sub_ext('.html')}#L#{location.line}" if Config.compare_branches_mode? file_path("#{File.expand_path(Config.feature_root_directory)}/#{smell_location}") else file_path(smell_location) end end
def timeago_tag(time)
def timeago_tag(time) "<time class='js-timeago' datetime='#{time}'>#{time}</time>" end