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
- #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
16 17 18 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 16 def asset_path(file) relative_path("assets/#{file}") end |
#file_path(file) ⇒ Object
24 25 26 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 24 def file_path(file) relative_path(file) end |
#image_path(file) ⇒ Object
20 21 22 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 20 def image_path(file) asset_path("images/#{file}") end |
#javascript_tag(file) ⇒ Object
8 9 10 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 8 def javascript_tag(file) "<script src='" + asset_path("javascripts/#{file}.js").to_s + "'></script>" end |
#smell_location_path(location) ⇒ Object
28 29 30 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 28 def smell_location_path(location) file_path("#{location.pathname.sub_ext('.html')}#L#{location.line}") end |
#stylesheet_path(file) ⇒ Object
12 13 14 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 12 def stylesheet_path(file) asset_path("stylesheets/#{file}.css") end |
#timeago_tag(time) ⇒ Object
4 5 6 |
# File 'lib/rubycritic/generators/html/view_helpers.rb', line 4 def timeago_tag(time) "<time class='js-timeago' datetime='#{time}'>#{time}</time>" end |