lib/awestruct/page.rb in awestruct-0.5.4.2 vs lib/awestruct/page.rb in awestruct-0.5.5
- old
+ new
@@ -92,11 +92,17 @@
def stale_output?(output_path)
return true if ! File.exist?( output_path )
return true if input_mtime > File.mtime( output_path )
return true if stale?
- # TODO: Add stale callback and execute it
+ return true if @stale_output_callback && @stale_output_callback.call(self)
false
+ end
+
+ # Define a stale check specific for this page. The parameter is expected
+ # to be a lambda or proc and is called with self as the argument.
+ def stale_output_callback= code
+ @stale_output_callback = block
end
def input_mtime
handler.input_mtime( self )
end