title: How can I monkey patch JRuby to give it a pseudo file system?
body: <p>Previously I was trying to <a href="https://stackoverflow.com/questions/13569734/how-can-i-provide-a-pseudo-file-system-for-r-js">give the Java engine for JavaScript - rhino - a pseudo file system</a> and I have had success (<a href="http://jszip.org" rel="nofollow noreferrer">jszip maven plugin</a>)</p>
  
  <p>I now am turning my attention to the <a href="http://sass-lang.com" rel="nofollow noreferrer">SASS compiler</a></p>
  
  <p>I have integrated JRuby into my Maven plugin and I can call through to the SASS compiler just fine, so now the final step (before the great refactoring from hack-land to maintainable code) is to fake out the paths that JRuby sees,</p>
  
  <p>My feeling is that I will not be able to reuse my Rhino trick (where I remap the java.io.File class adapter in the Rhino scope) as Ruby in general does not have adapter layers to correct for the differences between different Ruby VMs</p>
  
  <p>So my next thought was monkey patch... But I am unsure how big a job that would be...</p>
  
  <p>With JavaScript I just had to fake <code>java.io.File</code>, <code>java.io.FileReader</code>, <code>java.io.FileWriter</code>, <code>java.io.FileInputStream</code>, <code>java.io.FileOutputStream</code></p>
  
  <p>How much would I need to monkey patch in the Ruby runtime... Or am I better using an ASM based rewriting classloader to pull the rug from under JRuby itself (where I risk breaking legitimate File use to load eg Gems)</p>