Module: ViewInspect::ServerSideTemplate
- Defined in:
- lib/view_inspect/server_side_template.rb
Class Method Summary collapse
Class Method Details
.handle ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/view_inspect/server_side_template.rb', line 7 def self.handle Handlers::Haml.augment_source ::ActionView::Template.class_eval do alias_method :orig_initialize, :initialize # ActionView Template Resolver uses File.binread to read views # thus making ASCII-8BIT (alias for binary) the default encoding. # # libxml2 which nokogiri uses doesnt support ASCII-8BIT encoding. # That's why we need to encode first before letting nokogiri parse # html fragment and add file:line information to DOM nodes def initialize(source, identifier, handler, details) orig_initialize(source, identifier, handler, details) if handler.respond_to? :erb_implementation encode! @source = Handlers::ERB.new.(@source, identifier) end end end end |