Module: RubyCritic::ViewHelpers
- Included in:
- Generator::Html::Base
- Defined in:
- lib/rubycritic/generators/html/view_helpers.rb
Instance Method Summary collapse
- #asset_path(file) ⇒ Object
- #code_index_path(root_directory, file_name) ⇒ Object
- #file_path(file) ⇒ Object
- #image_path(file) ⇒ Object
- #javascript_tag(file) ⇒ Object
- #smell_location_path(location) ⇒ Object
- #stylesheet_path(file) ⇒ Object
- #timeago_tag(time) ⇒ Object
Instance Method Details
#asset_path(file) ⇒ Object
17 18 19 |
# 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) ⇒ Object
38 39 40 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 38 def code_index_path(root_directory, file_name) file_path("#{File.(root_directory)}/#{file_name}") end |
#file_path(file) ⇒ Object
25 26 27 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 25 def file_path(file) relative_path(file) end |
#image_path(file) ⇒ Object
21 22 23 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 21 def image_path(file) asset_path("images/#{file}") end |
#javascript_tag(file) ⇒ Object
9 10 11 |
# 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) ⇒ Object
29 30 31 32 33 34 35 36 |
# 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.(Config.feature_root_directory)}/#{smell_location}") else file_path(smell_location) end end |
#stylesheet_path(file) ⇒ Object
13 14 15 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 13 def stylesheet_path(file) asset_path("stylesheets/#{file}.css") end |
#timeago_tag(time) ⇒ Object
5 6 7 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 5 def timeago_tag(time) "<time class='js-timeago' datetime='#{time}'>#{time}</time>" end |