Module: Rubycritic::ViewHelpers

Included in:
Generator::Base
Defined in:
lib/rubycritic/report_generators/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#asset_path(*fragments) ⇒ Object



18
19
20
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 18

def asset_path(*fragments)
  relative_path(([root_directory, "assets"] + fragments).reduce(:+))
end

#file_path(file) ⇒ Object



22
23
24
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 22

def file_path(file)
  relative_path(root_directory + file)
end

#javascript_tag(file) ⇒ Object



10
11
12
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 10

def javascript_tag(file)
  "<script src='" + asset_path("javascripts", "#{file}.js").to_s + "'></script>"
end

#smell_location_path(location) ⇒ Object



26
27
28
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 26

def smell_location_path(location)
  relative_path(root_directory + "#{location.pathname.sub_ext('.html')}#L#{location.line}")
end

#stylesheet_path(file) ⇒ Object



14
15
16
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 14

def stylesheet_path(file)
  asset_path("stylesheets", "#{file}.css")
end

#timeago_tag(time) ⇒ Object



6
7
8
# File 'lib/rubycritic/report_generators/view_helpers.rb', line 6

def timeago_tag(time)
  "<time class='js-timeago' datetime='#{time}'>#{time}</time>"
end