module Rubycritic::ViewHelpers
def asset_path(*fragments)
def asset_path(*fragments) relative_path(([root_directory, "assets"] + fragments).reduce(:+)) end
def file_directory
def file_directory raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.") end
def file_path(file)
def file_path(file) relative_path(root_directory + file) end
def javascript_tag(file)
def javascript_tag(file) "<script src='" + asset_path("javascripts", "#{file}.js").to_s + "'></script>" end
def relative_path(pathname)
def relative_path(pathname) pathname.relative_path_from(file_directory) end
def root_directory
def root_directory raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.") end
def smell_location_path(location)
def smell_location_path(location) file_path("#{location.pathname.sub_ext('.html')}#L#{location.line}") end
def stylesheet_path(file)
def stylesheet_path(file) asset_path("stylesheets", "#{file}.css") end
def timeago_tag(time)
def timeago_tag(time) "<time class='js-timeago' datetime='#{time}'>#{time}</time>" end