# Common methods for PatchVersion-like models. They need a working :path # method, which must return the patch file path module PatchVersionLikeMethods def text @text || case path when nil raise RuntimeError, "Can't read patch text. Unsaved patch version?" else File.read(path) end end def size; text.size; end end