Docunext


private method open called for Rack File Class

October 27th, 2010

I'm trying to open a file from with a Ruby Rack extension I wrote called rack-xsl.

If I try "File.open(...)", it fails with this error:

private method `open' called for Rack::File:Class

Instead, I can use the double colon prefix, or colon colon class name, or ::File:

      if @options[:reload] == true
        @xslt     = XML::XSLT.new()
        refreshxsl = ::File.open(@options[:xslfilename]) {|f| f.read }
        @xslt.xsl = REXML::Document.new refreshxsl
      end

Sweet!

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022