Module: Integrity::AppExt

Defined in:
lib/integrity/metrics_extensions.rb

Instance Method Summary collapse

Instance Method Details

#extension_template_exists?(engine, template) ⇒ Boolean

Returns:

  • (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_pathObject



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, options = {}, locals = {})
  options[:views] = extension_view_path if extension_template_exists?(:haml, template) 
  super(template, options, locals)
end