Sha256: 5426c7db83f048a120cd5488690942959b5e1bb01af02d3b0d5b2ac23ab64fac
Contents?: true
Size: 721 Bytes
Versions: 3
Compression:
Stored size: 721 Bytes
Contents
module BetterSJR # Wraps JavaScript formatted templates in a try-catch statement when rendered module RendererExtensions # Overrides default behavior by wrapping rendered content in a try-catch # statement. # # If debugging is enabled and the template is JavaScript format, wrap the # rendered content in a try-catch statement. # # @return [String] the rendered template content def render_template(*) if debugging_sjr? && rendering_js? TryCatchStatement.new(super).wrapped_code else super end end def debugging_sjr? BetterSJR.debug_sjr end def rendering_js? lookup_context.rendered_format.to_s == "js" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
better_sjr-1.0.0 | lib/better_sjr/renderer_extensions.rb |
better_sjr-1.0.0.beta3 | lib/better_sjr/renderer_extensions.rb |
better_sjr-1.0.0.beta2 | lib/better_sjr/renderer_extensions.rb |