Skip to content

Commit

Permalink
do not blow up when required in an rails2 app
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Jun 15, 2012
1 parent ec87724 commit 5d3b1c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/hamlet/template.rb
Expand Up @@ -6,7 +6,8 @@ module Hamlet
if Object.const_defined?(:Rails)
# Rails template implementation for Hamlet
# @api public
RailsTemplate = Temple::Templates::Rails(Hamlet::Engine,
begin
RailsTemplate = Temple::Templates::Rails(Hamlet::Engine,
:register_as => :hamlet,
# Use rails-specific generator. This is necessary
# to support block capturing and streaming.
Expand All @@ -15,5 +16,8 @@ module Hamlet
# Rails takes care of the capturing by itself.
:disable_capture => true,
:streaming => Object.const_defined?(:Fiber))
rescue RuntimeError => e
warn "Failed to load RailsTemplate #{e.message}"
end
end
end

0 comments on commit 5d3b1c3

Please sign in to comment.