module AutoC::Module::SmartRenderer
@private
Attributes
digest[R]
def render_contents(stream)
Public Instance Methods
render()
click to toggle source
# File lib/autoc/module.rb, line 182 def render io = stream _file_name = io.path # Memorize temporary file name begin begin render_contents(io) @digest = io.digest ensure io.close end rescue File.unlink(_file_name) # Remove improperly rendered temporary file raise else if !File.exist?(file_name) || self.module.digests[file_name] != digest File.rename(_file_name, file_name) # Rendered temporary has different digest - replace original permanent file with it else File.unlink(_file_name) # New temporary has the same digest as permanent - no need to replace the latter, delete the temporary instead end end end