module RubyCritic::ViewHelpers

Public Instance Methods

asset_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 17
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 38
def code_index_path(root_directory, file_name)
  file_path("#{File.expand_path(root_directory)}/#{file_name}")
end
file_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 25
def file_path(file)
  relative_path(file)
end
image_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 21
def image_path(file)
  asset_path("images/#{file}")
end
javascript_tag(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 9
def javascript_tag(file)
  "<script src='" + asset_path("javascripts/#{file}.js").to_s + "'></script>"
end
smell_location_path(location) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 29
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
stylesheet_path(file) click to toggle source
# File lib/rubycritic/generators/html/view_helpers.rb, line 13
def stylesheet_path(file)
  asset_path("stylesheets/#{file}.css")
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 48
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 44
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 53
def root_directory
  raise NotImplementedError,
        "The #{self.class} class must implement the #{__method__} method."
end