Module: Activesupport
- Includes:
- ActionView::Context, ActionView::Helpers
- Included in:
- EasyHtmlGenerator::Generator::Compile::Haml::Context
- Defined in:
- lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb
Overview
this module overrides some active support methods for working paths etc.
Instance Method Summary collapse
- #append_asset_version(input) ⇒ Object
- #content_for(name, content = nil, options = {}, &block) ⇒ Object
- #orig_content_for ⇒ Object
- #path_to_image(path) ⇒ Object
- #path_to_javascript(path, path_options = {}) ⇒ Object
- #path_to_stylesheet(path, _options = {}) ⇒ Object
Instance Method Details
#append_asset_version(input) ⇒ Object
23 24 25 26 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 23 def append_asset_version(input) time = Time.now.to_i input.include?('?') ? "#{input}&t=#{time}" : "#{input}?t=#{time}" end |
#content_for(name, content = nil, options = {}, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 29 def content_for(name, content = nil, = {}, &block) if block_given? = content if content content = capture_haml(&block).html_safe end orig_content_for(name, content , ) end |
#orig_content_for ⇒ Object
28 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 28 alias_method :orig_content_for, :content_for |
#path_to_image(path) ⇒ Object
18 19 20 21 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 18 def path_to_image(path) return path if external_path? path append_asset_version @project.uri_path_to(:images, path) end |
#path_to_javascript(path, path_options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 13 def path_to_javascript(path, ={}) return path if external_path? path append_asset_version @project.uri_path_to(:scripts, path) end |
#path_to_stylesheet(path, _options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb', line 8 def path_to_stylesheet(path, = {}) return path if external_path?(path) append_asset_version @project.uri_path_to(:styles, path) end |