module RubyCritic::ViewHelpers

Public Instance Methods

asset_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 9
def asset_path(file)
  relative_path("assets/#{file}")
end
code_index_path(root_directory, file_name) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 26
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
file_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 13
def file_path(file)
  relative_path(file)
end
smell_location_path(location) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 17
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
timeago_tag(time) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 5
def timeago_tag(time)
  "<time class='js-timeago' datetime='#{time}'>#{time}</time>"
end

Private Instance Methods

file_directory() click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 39
def file_directory
  raise NotImplementedError,
        "The #{self.class} class must implement the #{__method__} method."
end
relative_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 35
def relative_path(file)
  (root_directory + file).relative_path_from(file_directory)
end
root_directory() click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 44
def root_directory
  raise NotImplementedError,
        "The #{self.class} class must implement the #{__method__} method."
end