lib/xray/engine.rb in xray-rails-0.1.12 vs lib/xray/engine.rb in xray-rails-0.1.13

- old
+ new

@@ -26,10 +26,12 @@ # with filepath information. See `Xray.augment_template` for details. ActionView::Template.class_eval do def render_with_xray(*args, &block) path = identifier source = render_without_xray(*args, &block) - if path =~ /\.(html|slim|haml)(\.|$)/ && !path.match(/\.(js|json)\./) && !path.include?('_xray_bar') + suitable_template = path =~ /\.(html|slim|haml)(\.|$)/ && !path.match(/\.(js|json)\./) && !path.include?('_xray_bar') + options = args.last.kind_of?(Hash) ? args.last : {} + if suitable_template && !(options.has_key?(:xray) && (options[:xray] == false)) Xray.augment_template(source, path) else source end end