Module: Integrity::AppExt
- Defined in:
- lib/integrity/metrics_extensions.rb
Instance Method Summary collapse
- #extension_template_exists?(engine, template) ⇒ Boolean
- #extension_view_path ⇒ Object
-
#haml(template, options = {}, locals = {}) ⇒ Object
Interferes with haml rendering to give priority to extension templates.
Instance Method Details
#extension_template_exists?(engine, template) ⇒ Boolean
11 12 13 |
# File 'lib/integrity/metrics_extensions.rb', line 11 def extension_template_exists?(engine, template) File.exist?(File.join(extension_view_path, "#{template}.#{engine}")) end |
#extension_view_path ⇒ Object
15 16 17 |
# File 'lib/integrity/metrics_extensions.rb', line 15 def extension_view_path File.join(File.dirname(__FILE__), '/../../views') end |
#haml(template, options = {}, locals = {}) ⇒ Object
Interferes with haml rendering to give priority to extension templates. Crudely done here in preparation for a more general solution in Integrity.
6 7 8 9 |
# File 'lib/integrity/metrics_extensions.rb', line 6 def haml(template, = {}, locals = {}) [:views] = extension_view_path if extension_template_exists?(:haml, template) super(template, , locals) end |