Class: N::CompressShader

Inherits:
Shader show all
Defined in:
lib/nitro/shaders.rb

Overview

Compress the inline xhtml. Does not touch the ruby code.

Instance Attribute Summary

Attributes inherited from Shader

#next_stage

Instance Method Summary collapse

Methods inherited from Shader

#<<, #initialize, #process_next

Constructor Details

This class inherits a constructor from N::Shader

Instance Method Details

#process(hash, text) ⇒ Object

Compress the inline xhtml. Does not touch the ruby code.



214
215
216
217
218
219
220
221
# File 'lib/nitro/shaders.rb', line 214

def process(hash, text)
	text.gsub!(/\@out \<\< \%\^(.*?)\^/m) do |match|
		c = $1.gsub(/^(\s*)/m, '').squeeze(" \t").tr("\n", '').tr("\t", ' ')
		"@out << %{#{c}}"
	end
	
	process_next(hash, text)
end